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 characters
WITH constants AS ( | |
-- define some constants for sizes of things | |
-- for reference down the query and easy maintenance | |
SELECT current_setting('block_size')::numeric AS bs, 23 AS hdr, 8 AS ma | |
), | |
no_stats AS ( | |
-- screen out table who have attributes | |
-- which dont have stats, such as JSON | |
SELECT table_schema, table_name, | |
n_live_tup::numeric as est_rows, |
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 characters
-- Set number of shard | |
ALTER DATABASE citus SET citus.shard_count = 64; | |
-- Explain across all shards | |
SET citus.explain_all_tasks TO true; | |
-- Size of all distributed tables excluding indexes but including TOAST, free space map, and visibility map | |
SELECT logicalrelid::text tablename, pg_size_pretty(citus_table_size(logicalrelid::text)) size FROM pg_dist_partition group by tablename; | |
-- Size of all distributed tables including all indexes and TOAST data |