-- -- MULTI_SIZE_QUERIES -- -- Test checks whether size of distributed tables can be obtained with citus_table_size. -- To find the relation size and total relation size citus_relation_size and -- citus_total_relation_size are also tested. ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1390000; ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1390000; -- Tests on distributed table with replication factor > 1 SELECT citus_table_size('lineitem_hash_part'); ERROR: cannot calculate the size because replication factor is greater than 1 SELECT citus_relation_size('lineitem_hash_part'); ERROR: cannot calculate the size because replication factor is greater than 1 SELECT citus_total_relation_size('lineitem_hash_part'); ERROR: cannot calculate the size because replication factor is greater than 1 VACUUM (FULL) customer_copy_hash; -- Tests on distributed tables with streaming replication. SELECT citus_table_size('customer_copy_hash'); citus_table_size ------------------ 548864 (1 row) SELECT citus_relation_size('customer_copy_hash'); citus_relation_size --------------------- 548864 (1 row) SELECT citus_total_relation_size('customer_copy_hash'); citus_total_relation_size --------------------------- 1597440 (1 row) CREATE INDEX index_1 on customer_copy_hash(c_custkey); NOTICE: using one-phase commit for distributed DDL commands HINT: You can enable two-phase commit for extra safety with: SET citus.multi_shard_commit_protocol TO '2pc' VACUUM (FULL) customer_copy_hash; -- Tests on distributed table with index. SELECT citus_table_size('customer_copy_hash'); citus_table_size ------------------ 548864 (1 row) SELECT citus_relation_size('customer_copy_hash'); citus_relation_size --------------------- 548864 (1 row) SELECT citus_total_relation_size('customer_copy_hash'); citus_total_relation_size --------------------------- 2646016 (1 row) -- Tests on reference table VACUUM (FULL) supplier; SELECT citus_table_size('supplier'); citus_table_size ------------------ 376832 (1 row) SELECT citus_relation_size('supplier'); citus_relation_size --------------------- 376832 (1 row) SELECT citus_total_relation_size('supplier'); citus_total_relation_size --------------------------- 376832 (1 row) CREATE INDEX index_2 on supplier(s_suppkey); VACUUM (FULL) supplier; SELECT citus_table_size('supplier'); citus_table_size ------------------ 376832 (1 row) SELECT citus_relation_size('supplier'); citus_relation_size --------------------- 376832 (1 row) SELECT citus_total_relation_size('supplier'); citus_total_relation_size --------------------------- 458752 (1 row) -- Test inside the transaction BEGIN; ALTER TABLE supplier ALTER COLUMN s_suppkey SET NOT NULL; select citus_table_size('supplier'); ERROR: citus size functions cannot be called in transaction blocks which contain multi-shard data modifications END; DROP INDEX index_1; DROP INDEX index_2;