Chipintoza
Chipintoza

Reputation: 295

Spanner - How to find table size

cloud spanner in database detail has: Total storage.

enter image description here

Can i take this value by query?

Also how to find tables sizes (by query). At the end of which will be total storage size.

Thank you

Upvotes: 2

Views: 1828

Answers (3)

SQLmojoe
SQLmojoe

Reputation: 2043

Just released table size statistics system table that includes table and index sizes. Sample query from docs:

SELECT interval_end
      ,table_name
      ,used_bytes
FROM spanner_sys.table_sizes_stats_1hour
WHERE interval_end = 
      (
      SELECT MAX(interval_end)
      FROM spanner_sys.table_sizes_stats_1hour
      )
ORDER BY used_bytes DESC;

See full details at https://cloud.google.com/spanner/docs/introspection/table-sizes-statistics

Upvotes: 1

shlomiw
shlomiw

Reputation: 365

To get a general idea of the tables size porportions, we check the resulted avro files sizes when exporting the DB (we have a daily job for backup). Of-course it is not accurate since it's a whole different storage model.

Upvotes: 2

Reid Hironaga
Reid Hironaga

Reputation: 246

Cloud Spanner table sizes aren't currently exposed.

Upvotes: 2

Related Questions