Created
October 15, 2021 10:27
-
-
Save ayush--s/2838a27242d345890ee5bde70d0e4555 to your computer and use it in GitHub Desktop.
Revisions
-
ayush--s created this gist
Oct 15, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ WITH size AS ( SELECT concat(chunk_schema, '.', chunk_name) AS name, round(table_bytes / (1024 * 1024.0), 2) AS table_megs, round(index_bytes / (1024 * 1024.0), 2) AS index_megs, round(total_bytes / (1024 * 1024.0), 2) AS total_megs FROM chunks_detailed_size ('%%table%%') ORDER BY chunk_name, node_name ), timerange AS ( SELECT * FROM chunks_tstz WHERE hypertable::text = '%%table%%' ) SELECT chunk, table_megs, index_megs, total_megs, time_range FROM size s INNER JOIN timerange t ON s.name = t.chunk::text ORDER BY time_range DESC