Skip to content

Instantly share code, notes, and snippets.

@samouss
samouss / citus_cheatsheet.sql
Created August 27, 2020 17:38 — forked from sfriquet/citus_cheatsheet.sql
Citus Cheatsheet
-- 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