From 7d64ddf4c2f525b5e6e60b71a7d16b722f09d6d8 Mon Sep 17 00:00:00 2001 From: Sameer Awasekar Date: Wed, 3 Aug 2022 22:22:08 +0530 Subject: [PATCH] Add partition and columnar support test --- .../shardsplit_logical_replication.c | 29 +- ... => citus_non_blocking_split_columnar.out} | 714 +++++++++++------- ...citus_non_blocking_split_shard_cleanup.out | 10 +- src/test/regress/split_schedule | 2 +- ... => citus_non_blocking_split_columnar.sql} | 73 +- ...citus_non_blocking_split_shard_cleanup.sql | 10 +- 6 files changed, 508 insertions(+), 330 deletions(-) rename src/test/regress/expected/{citus_non_blocking_split_shard_partitioned.out => citus_non_blocking_split_columnar.out} (51%) rename src/test/regress/sql/{citus_non_blocking_split_shard_partitioned.sql => citus_non_blocking_split_columnar.sql} (79%) diff --git a/src/backend/distributed/shardsplit/shardsplit_logical_replication.c b/src/backend/distributed/shardsplit/shardsplit_logical_replication.c index 47ad269e3..d410296be 100644 --- a/src/backend/distributed/shardsplit/shardsplit_logical_replication.c +++ b/src/backend/distributed/shardsplit/shardsplit_logical_replication.c @@ -81,6 +81,11 @@ CreateShardSplitInfoMapForPublication(List *sourceColocatedShardIntervalList, forboth_ptr(sourceShardIntervalToCopy, sourceColocatedShardIntervalList, splitChildShardIntervalList, shardGroupSplitIntervalListList) { + /* + * Skipping partitioned table for logical replication. + * Since PG13, logical replication is supported for partitioned tables. + * However, we want to keep the behaviour consistent with shard moves. + */ if (PartitionedTable(sourceShardIntervalToCopy->relationId)) { continue; @@ -93,12 +98,20 @@ CreateShardSplitInfoMapForPublication(List *sourceColocatedShardIntervalList, { uint32 destinationWorkerNodeId = destinationWorkerNode->nodeId; - /* Add split child shard interval */ - AddPublishableShardEntryInMap(destinationWorkerNodeId, - splitChildShardInterval, - true /*isChildShardInterval*/); + /* Add child shard for publication. + * If a columnar shard is a part of publications, then writes on the shard fail. + * In the case of local split, adding child shards to the publication + * would prevent copying the initial data done through 'DoSplitCopy'. + * Hence we avoid adding columnar child shards to publication. + */ + if (!extern_IsColumnarTableAmTable(splitChildShardInterval->relationId)) + { + AddPublishableShardEntryInMap(destinationWorkerNodeId, + splitChildShardInterval, + true /*isChildShardInterval*/); + } - /* Add parent shard interval if not already added */ + /* Add parent shard if not already added */ AddPublishableShardEntryInMap(destinationWorkerNodeId, sourceShardIntervalToCopy, false /*isChildShardInterval*/); @@ -393,7 +406,8 @@ WaitForShardSplitRelationSubscriptionsBecomeReady(List *shardSplitPubSubMetadata ShardSplitSubscriberMetadata *shardSplitPubSubMetadata = NULL; foreach_ptr(shardSplitPubSubMetadata, shardSplitPubSubMetadataList) { - Bitmapset *tableOwnerIds = bms_make_singleton(shardSplitPubSubMetadata->tableOwnerId); + Bitmapset *tableOwnerIds = bms_make_singleton( + shardSplitPubSubMetadata->tableOwnerId); WaitForRelationSubscriptionsBecomeReady( shardSplitPubSubMetadata->targetNodeConnection, tableOwnerIds, SHARD_SPLIT_SUBSCRIPTION_PREFIX); @@ -412,7 +426,8 @@ WaitForShardSplitRelationSubscriptionsToBeCaughtUp(XLogRecPtr sourcePosition, ShardSplitSubscriberMetadata *shardSplitPubSubMetadata = NULL; foreach_ptr(shardSplitPubSubMetadata, shardSplitPubSubMetadataList) { - Bitmapset *tableOwnerIds = bms_make_singleton(shardSplitPubSubMetadata->tableOwnerId); + Bitmapset *tableOwnerIds = bms_make_singleton( + shardSplitPubSubMetadata->tableOwnerId); WaitForShardSubscriptionToCatchUp(shardSplitPubSubMetadata->targetNodeConnection, sourcePosition, tableOwnerIds, diff --git a/src/test/regress/expected/citus_non_blocking_split_shard_partitioned.out b/src/test/regress/expected/citus_non_blocking_split_columnar.out similarity index 51% rename from src/test/regress/expected/citus_non_blocking_split_shard_partitioned.out rename to src/test/regress/expected/citus_non_blocking_split_columnar.out index c85dfab7b..c54b3f827 100644 --- a/src/test/regress/expected/citus_non_blocking_split_shard_partitioned.out +++ b/src/test/regress/expected/citus_non_blocking_split_columnar.out @@ -1,5 +1,5 @@ -CREATE SCHEMA "citus_split_test_schema_partitioned"; -SET search_path TO "citus_split_test_schema_partitioned"; +CREATE SCHEMA "citus_split_test_schema_columnar_partitioned"; +SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.next_shard_id TO 8970000; SET citus.next_placement_id TO 8770000; SET citus.shard_count TO 1; @@ -11,23 +11,45 @@ SET citus.shard_replication_factor TO 1; measure_data jsonb, PRIMARY KEY (measureid, eventdatetime, measure_data)) PARTITION BY RANGE(eventdatetime); + -- Table access method is specified on child tables + CREATE TABLE sensorscolumnar( + measureid integer, + eventdatetime date, + measure_data jsonb, + PRIMARY KEY (measureid, eventdatetime, measure_data)) + PARTITION BY RANGE(eventdatetime); -- Create Partitions of table 'sensors'. CREATE TABLE sensors_old PARTITION OF sensors FOR VALUES FROM ('2000-01-01') TO ('2020-01-01'); CREATE TABLE sensors_2020_01_01 PARTITION OF sensors FOR VALUES FROM ('2020-01-01') TO ('2020-02-01'); CREATE TABLE sensors_news PARTITION OF sensors FOR VALUES FROM ('2020-05-01') TO ('2025-01-01'); + CREATE TABLE sensorscolumnar_old PARTITION OF sensorscolumnar FOR VALUES FROM ('2000-01-01') TO ('2020-01-01') USING COLUMNAR; + CREATE TABLE sensorscolumnar_2020_01_01 PARTITION OF sensorscolumnar FOR VALUES FROM ('2020-01-01') TO ('2020-02-01') USING COLUMNAR; + CREATE TABLE sensorscolumnar_news PARTITION OF sensorscolumnar FOR VALUES FROM ('2020-05-01') TO ('2025-01-01') USING COLUMNAR; -- Create index on parent and child partitions. CREATE INDEX index_on_parent ON sensors(lower(measureid::text)); CREATE INDEX index_on_child ON sensors_2020_01_01(lower(measure_data::text)); + CREATE INDEX index_on_parent_columnar ON sensorscolumnar(lower(measureid::text)); + CREATE INDEX index_on_child_columnar ON sensorscolumnar_2020_01_01(lower(measure_data::text)); ALTER INDEX index_on_parent ALTER COLUMN 1 SET STATISTICS 1000; ALTER INDEX index_on_child ALTER COLUMN 1 SET STATISTICS 1000; + ALTER INDEX index_on_parent_columnar ALTER COLUMN 1 SET STATISTICS 1000; + ALTER INDEX index_on_child_columnar ALTER COLUMN 1 SET STATISTICS 1000; -- Create statistics on parent and child partitions. CREATE STATISTICS s1 (dependencies) ON measureid, eventdatetime FROM sensors; CREATE STATISTICS s2 (dependencies) ON measureid, eventdatetime FROM sensors_2020_01_01; + CREATE STATISTICS s1_c (dependencies) ON measureid, eventdatetime FROM sensorscolumnar; + CREATE STATISTICS s2_c (dependencies) ON measureid, eventdatetime FROM sensorscolumnar_2020_01_01; CLUSTER sensors_2020_01_01 USING index_on_child; SELECT create_distributed_table('sensors', 'measureid'); create_distributed_table --------------------------------------------------------------------- +(1 row) + + SELECT create_distributed_table('sensorscolumnar', 'measureid'); + create_distributed_table +--------------------------------------------------------------------- + (1 row) -- create colocated distributed tables @@ -66,20 +88,24 @@ SET citus.shard_replication_factor TO 1; INNER JOIN pg_dist_node node ON placement.groupid = node.groupid INNER JOIN pg_catalog.pg_class cls ON shard.logicalrelid = cls.oid INNER JOIN pg_catalog.pg_namespace ns ON cls.relnamespace = ns.oid - WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_partitioned' - ORDER BY logicalrelid, shardminvalue::BIGINT; + WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_columnar_partitioned' + ORDER BY logicalrelid, shardminvalue::BIGINT, nodeport; shardid | logicalrelid | shardminvalue | shardmaxvalue | nodename | nodeport --------------------------------------------------------------------- 8970000 | sensors | -2147483648 | 2147483647 | localhost | 57637 + 8970004 | sensorscolumnar | -2147483648 | 2147483647 | localhost | 57637 8970001 | sensors_old | -2147483648 | 2147483647 | localhost | 57637 8970002 | sensors_2020_01_01 | -2147483648 | 2147483647 | localhost | 57637 8970003 | sensors_news | -2147483648 | 2147483647 | localhost | 57637 - 8970004 | colocated_dist_table | -2147483648 | 2147483647 | localhost | 57637 - 8970005 | colocated_partitioned_table | -2147483648 | 2147483647 | localhost | 57637 - 8970006 | colocated_partitioned_table_2020_01_01 | -2147483648 | 2147483647 | localhost | 57637 - 8970007 | reference_table | | | localhost | 57637 - 8970007 | reference_table | | | localhost | 57638 -(9 rows) + 8970005 | sensorscolumnar_old | -2147483648 | 2147483647 | localhost | 57637 + 8970006 | sensorscolumnar_2020_01_01 | -2147483648 | 2147483647 | localhost | 57637 + 8970007 | sensorscolumnar_news | -2147483648 | 2147483647 | localhost | 57637 + 8970008 | colocated_dist_table | -2147483648 | 2147483647 | localhost | 57637 + 8970009 | colocated_partitioned_table | -2147483648 | 2147483647 | localhost | 57637 + 8970010 | colocated_partitioned_table_2020_01_01 | -2147483648 | 2147483647 | localhost | 57637 + 8970011 | reference_table | | | localhost | 57637 + 8970011 | reference_table | | | localhost | 57638 +(13 rows) -- END: Create table to split, along with other co-located tables. Add indexes, statistics etc. -- BEGIN: Create constraints for tables. @@ -105,10 +131,11 @@ SET citus.shard_replication_factor TO 1; INSERT INTO colocated_dist_table SELECT i FROM generate_series(0,1000)i; INSERT INTO colocated_partitioned_table SELECT i, '2020-01-05' FROM generate_series(0,1000)i; INSERT INTO sensors SELECT i, '2020-01-05', '{}' FROM generate_series(0,1000)i; + INSERT INTO sensorscolumnar SELECT i, '2020-01-05', '{}' FROM generate_series(0,1000)i; -- END: Load data into tables -- BEGIN: Show the current state on workers \c - - - :worker_1_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -117,65 +144,78 @@ SET citus.shard_replication_factor TO 1; ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8970002 | fkey_from_child_to_child_8970002 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970006(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_child_to_dist_8970002 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970004(measureid) - sensors_2020_01_01_8970002 | fkey_from_child_to_parent_8970002 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970005(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_child_to_ref_8970002 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970006(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970004(measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970005(eventdatetime, measureid) - sensors_2020_01_01_8970002 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8970002 | sensors_2020_01_01_8970002_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970006(eventdatetime, measureid) - sensors_8970000 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970006(eventdatetime, measureid) - sensors_8970000 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970004(measureid) - sensors_8970000 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970005(eventdatetime, measureid) - sensors_8970000 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_8970000 | sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970006(eventdatetime, measureid) - sensors_news_8970003 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970006(eventdatetime, measureid) - sensors_news_8970003 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970004(measureid) - sensors_news_8970003 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970005(eventdatetime, measureid) - sensors_news_8970003 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_old_8970001 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970006(eventdatetime, measureid) - sensors_old_8970001 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970004(measureid) - sensors_old_8970001 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970005(eventdatetime, measureid) - sensors_old_8970001 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) + sensors_2020_01_01_8970002 | fkey_from_child_to_child_8970002 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_2020_01_01_8970002 | fkey_from_child_to_dist_8970002 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_2020_01_01_8970002 | fkey_from_child_to_parent_8970002 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_2020_01_01_8970002 | fkey_from_child_to_ref_8970002 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8970002 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_2020_01_01_8970002 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_2020_01_01_8970002 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_2020_01_01_8970002 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8970002 | sensors_2020_01_01_8970002_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_8970000 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_8970000 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_8970000 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_8970000 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8970000 | sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_news_8970003 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_news_8970003 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_news_8970003 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_news_8970003 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8970001 | fkey_from_parent_to_child_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970010(eventdatetime, measureid) + sensors_old_8970001 | fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970008(measureid) + sensors_old_8970001 | fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970009(eventdatetime, measureid) + sensors_old_8970001 | fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; - tablename | indexdef + tablename | indexdef --------------------------------------------------------------------- - colocated_dist_table_8970004 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8970004 ON citus_split_test_schema_partitioned.colocated_dist_table_8970004 USING btree (measureid) - colocated_partitioned_table_2020_01_01_8970006 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8970006 ON citus_split_test_schema_partitioned.colocated_partitioned_table_2020_01_01_8970006 USING btree (measureid, eventdatetime) - colocated_partitioned_table_8970005 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8970005 ON ONLY citus_split_test_schema_partitioned.colocated_partitioned_table_8970005 USING btree (measureid, eventdatetime) - reference_table_8970007 | CREATE UNIQUE INDEX reference_table_pkey_8970007 ON citus_split_test_schema_partitioned.reference_table_8970007 USING btree (measureid) - sensors_2020_01_01_8970002 | CREATE INDEX index_on_child_8970002 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8970002 USING btree (lower((measure_data)::text)) - sensors_2020_01_01_8970002 | CREATE INDEX sensors_2020_01_01_lower_idx_8970002 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8970002 USING btree (lower((measureid)::text)) - sensors_2020_01_01_8970002 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8970002 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8970002 USING btree (measureid, eventdatetime, measure_data) - sensors_8970000 | CREATE INDEX index_on_parent_8970000 ON ONLY citus_split_test_schema_partitioned.sensors_8970000 USING btree (lower((measureid)::text)) - sensors_8970000 | CREATE UNIQUE INDEX sensors_pkey_8970000 ON ONLY citus_split_test_schema_partitioned.sensors_8970000 USING btree (measureid, eventdatetime, measure_data) - sensors_news_8970003 | CREATE INDEX sensors_news_lower_idx_8970003 ON citus_split_test_schema_partitioned.sensors_news_8970003 USING btree (lower((measureid)::text)) - sensors_news_8970003 | CREATE UNIQUE INDEX sensors_news_pkey_8970003 ON citus_split_test_schema_partitioned.sensors_news_8970003 USING btree (measureid, eventdatetime, measure_data) - sensors_old_8970001 | CREATE INDEX sensors_old_lower_idx_8970001 ON citus_split_test_schema_partitioned.sensors_old_8970001 USING btree (lower((measureid)::text)) - sensors_old_8970001 | CREATE UNIQUE INDEX sensors_old_pkey_8970001 ON citus_split_test_schema_partitioned.sensors_old_8970001 USING btree (measureid, eventdatetime, measure_data) -(13 rows) + colocated_dist_table_8970008 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8970008 ON citus_split_test_schema_columnar_partitioned.colocated_dist_table_8970008 USING btree (measureid) + colocated_partitioned_table_2020_01_01_8970010 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8970010 ON citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_2020_01_01_8970010 USING btree (measureid, eventdatetime) + colocated_partitioned_table_8970009 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8970009 ON ONLY citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_8970009 USING btree (measureid, eventdatetime) + reference_table_8970011 | CREATE UNIQUE INDEX reference_table_pkey_8970011 ON citus_split_test_schema_columnar_partitioned.reference_table_8970011 USING btree (measureid) + sensors_2020_01_01_8970002 | CREATE INDEX index_on_child_8970002 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8970002 USING btree (lower((measure_data)::text)) + sensors_2020_01_01_8970002 | CREATE INDEX sensors_2020_01_01_lower_idx_8970002 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8970002 USING btree (lower((measureid)::text)) + sensors_2020_01_01_8970002 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8970002 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8970002 USING btree (measureid, eventdatetime, measure_data) + sensors_8970000 | CREATE INDEX index_on_parent_8970000 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8970000 USING btree (lower((measureid)::text)) + sensors_8970000 | CREATE UNIQUE INDEX sensors_pkey_8970000 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8970000 USING btree (measureid, eventdatetime, measure_data) + sensors_news_8970003 | CREATE INDEX sensors_news_lower_idx_8970003 ON citus_split_test_schema_columnar_partitioned.sensors_news_8970003 USING btree (lower((measureid)::text)) + sensors_news_8970003 | CREATE UNIQUE INDEX sensors_news_pkey_8970003 ON citus_split_test_schema_columnar_partitioned.sensors_news_8970003 USING btree (measureid, eventdatetime, measure_data) + sensors_old_8970001 | CREATE INDEX sensors_old_lower_idx_8970001 ON citus_split_test_schema_columnar_partitioned.sensors_old_8970001 USING btree (lower((measureid)::text)) + sensors_old_8970001 | CREATE UNIQUE INDEX sensors_old_pkey_8970001 ON citus_split_test_schema_columnar_partitioned.sensors_old_8970001 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_2020_01_01_8970006 | CREATE INDEX index_on_child_columnar_8970006 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8970006 USING btree (lower((measure_data)::text)) + sensorscolumnar_2020_01_01_8970006 | CREATE INDEX sensorscolumnar_2020_01_01_lower_idx_8970006 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8970006 USING btree (lower((measureid)::text)) + sensorscolumnar_2020_01_01_8970006 | CREATE UNIQUE INDEX sensorscolumnar_2020_01_01_pkey_8970006 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8970006 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_8970004 | CREATE INDEX index_on_parent_columnar_8970004 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8970004 USING btree (lower((measureid)::text)) + sensorscolumnar_8970004 | CREATE UNIQUE INDEX sensorscolumnar_pkey_8970004 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8970004 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_news_8970007 | CREATE INDEX sensorscolumnar_news_lower_idx_8970007 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8970007 USING btree (lower((measureid)::text)) + sensorscolumnar_news_8970007 | CREATE UNIQUE INDEX sensorscolumnar_news_pkey_8970007 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8970007 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_old_8970005 | CREATE INDEX sensorscolumnar_old_lower_idx_8970005 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8970005 USING btree (lower((measureid)::text)) + sensorscolumnar_old_8970005 | CREATE UNIQUE INDEX sensorscolumnar_old_pkey_8970005 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8970005 USING btree (measureid, eventdatetime, measure_data) +(22 rows) SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; - stxname + stxname --------------------------------------------------------------------- s1 s1_8970000 + s1_c + s1_c_8970004 s2 s2_8970002 -(4 rows) + s2_c + s2_c_8970006 +(8 rows) \c - - - :worker_2_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -187,28 +227,30 @@ SET citus.shard_replication_factor TO 1; (0 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; - tablename | indexdef + tablename | indexdef --------------------------------------------------------------------- - reference_table_8970007 | CREATE UNIQUE INDEX reference_table_pkey_8970007 ON citus_split_test_schema_partitioned.reference_table_8970007 USING btree (measureid) + reference_table_8970011 | CREATE UNIQUE INDEX reference_table_pkey_8970011 ON citus_split_test_schema_columnar_partitioned.reference_table_8970011 USING btree (measureid) (1 row) SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; stxname --------------------------------------------------------------------- s1 + s1_c s2 -(2 rows) + s2_c +(4 rows) -- END: Show the current state on workers -- BEGIN: Split a shard along its co-located shards \c - - - :master_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.next_shard_id TO 8999000; SELECT nodeid AS worker_1_node FROM pg_dist_node WHERE nodeport=:worker_1_port \gset SELECT nodeid AS worker_2_node FROM pg_dist_node WHERE nodeport=:worker_2_port \gset @@ -230,27 +272,35 @@ SET citus.shard_replication_factor TO 1; INNER JOIN pg_dist_node node ON placement.groupid = node.groupid INNER JOIN pg_catalog.pg_class cls ON shard.logicalrelid = cls.oid INNER JOIN pg_catalog.pg_namespace ns ON cls.relnamespace = ns.oid - WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_partitioned' - ORDER BY logicalrelid, shardminvalue::BIGINT; + WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_columnar_partitioned' + ORDER BY logicalrelid, shardminvalue::BIGINT, nodeport; shardid | logicalrelid | shardminvalue | shardmaxvalue | nodename | nodeport --------------------------------------------------------------------- 8999000 | sensors | -2147483648 | -2120000000 | localhost | 57637 8999001 | sensors | -2119999999 | 2147483647 | localhost | 57638 + 8999008 | sensorscolumnar | -2147483648 | -2120000000 | localhost | 57637 + 8999009 | sensorscolumnar | -2119999999 | 2147483647 | localhost | 57638 8999002 | sensors_old | -2147483648 | -2120000000 | localhost | 57637 8999003 | sensors_old | -2119999999 | 2147483647 | localhost | 57638 8999004 | sensors_2020_01_01 | -2147483648 | -2120000000 | localhost | 57637 8999005 | sensors_2020_01_01 | -2119999999 | 2147483647 | localhost | 57638 8999006 | sensors_news | -2147483648 | -2120000000 | localhost | 57637 8999007 | sensors_news | -2119999999 | 2147483647 | localhost | 57638 - 8999008 | colocated_dist_table | -2147483648 | -2120000000 | localhost | 57637 - 8999009 | colocated_dist_table | -2119999999 | 2147483647 | localhost | 57638 - 8999010 | colocated_partitioned_table | -2147483648 | -2120000000 | localhost | 57637 - 8999011 | colocated_partitioned_table | -2119999999 | 2147483647 | localhost | 57638 - 8999012 | colocated_partitioned_table_2020_01_01 | -2147483648 | -2120000000 | localhost | 57637 - 8999013 | colocated_partitioned_table_2020_01_01 | -2119999999 | 2147483647 | localhost | 57638 - 8970007 | reference_table | | | localhost | 57637 - 8970007 | reference_table | | | localhost | 57638 -(16 rows) + 8999010 | sensorscolumnar_old | -2147483648 | -2120000000 | localhost | 57637 + 8999011 | sensorscolumnar_old | -2119999999 | 2147483647 | localhost | 57638 + 8999012 | sensorscolumnar_2020_01_01 | -2147483648 | -2120000000 | localhost | 57637 + 8999013 | sensorscolumnar_2020_01_01 | -2119999999 | 2147483647 | localhost | 57638 + 8999014 | sensorscolumnar_news | -2147483648 | -2120000000 | localhost | 57637 + 8999015 | sensorscolumnar_news | -2119999999 | 2147483647 | localhost | 57638 + 8999016 | colocated_dist_table | -2147483648 | -2120000000 | localhost | 57637 + 8999017 | colocated_dist_table | -2119999999 | 2147483647 | localhost | 57638 + 8999018 | colocated_partitioned_table | -2147483648 | -2120000000 | localhost | 57637 + 8999019 | colocated_partitioned_table | -2119999999 | 2147483647 | localhost | 57638 + 8999020 | colocated_partitioned_table_2020_01_01 | -2147483648 | -2120000000 | localhost | 57637 + 8999021 | colocated_partitioned_table_2020_01_01 | -2119999999 | 2147483647 | localhost | 57638 + 8970011 | reference_table | | | localhost | 57637 + 8970011 | reference_table | | | localhost | 57638 +(24 rows) SELECT count(*) FROM reference_table; count @@ -276,10 +326,16 @@ SET citus.shard_replication_factor TO 1; 1001 (1 row) + SELECT count(*) FROM sensorscolumnar; + count +--------------------------------------------------------------------- + 1001 +(1 row) + -- END: Validate Shard Info and Data -- BEGIN: Show the updated state on workers \c - - - :worker_1_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -288,65 +344,78 @@ SET citus.shard_replication_factor TO 1; ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999004 | fkey_from_child_to_child_8999004 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999012(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_child_to_dist_8999004 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999008(measureid) - sensors_2020_01_01_8999004 | fkey_from_child_to_parent_8999004 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999010(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_child_to_ref_8999004 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999012(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999008(measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999010(eventdatetime, measureid) - sensors_2020_01_01_8999004 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999004 | sensors_2020_01_01_8999004_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999012(eventdatetime, measureid) - sensors_8999000 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999012(eventdatetime, measureid) - sensors_8999000 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999008(measureid) - sensors_8999000 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999010(eventdatetime, measureid) - sensors_8999000 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_8999000 | sensors_8999000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999012(eventdatetime, measureid) - sensors_news_8999006 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999012(eventdatetime, measureid) - sensors_news_8999006 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999008(measureid) - sensors_news_8999006 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999010(eventdatetime, measureid) - sensors_news_8999006 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_old_8999002 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999012(eventdatetime, measureid) - sensors_old_8999002 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999008(measureid) - sensors_old_8999002 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999010(eventdatetime, measureid) - sensors_old_8999002 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) + sensors_2020_01_01_8999004 | fkey_from_child_to_child_8999004 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_2020_01_01_8999004 | fkey_from_child_to_dist_8999004 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_2020_01_01_8999004 | fkey_from_child_to_parent_8999004 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_2020_01_01_8999004 | fkey_from_child_to_ref_8999004 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999004 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_2020_01_01_8999004 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_2020_01_01_8999004 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_2020_01_01_8999004 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999004 | sensors_2020_01_01_8999004_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_8999000 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_8999000 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_8999000 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_8999000 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999000 | sensors_8999000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_news_8999006 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_news_8999006 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_news_8999006 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_news_8999006 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999002 | fkey_from_parent_to_child_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999020(eventdatetime, measureid) + sensors_old_8999002 | fkey_from_parent_to_dist_8999000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999016(measureid) + sensors_old_8999002 | fkey_from_parent_to_parent_8999000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999018(eventdatetime, measureid) + sensors_old_8999002 | fkey_from_parent_to_ref_8999000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; - tablename | indexdef + tablename | indexdef --------------------------------------------------------------------- - colocated_dist_table_8999008 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999008 ON citus_split_test_schema_partitioned.colocated_dist_table_8999008 USING btree (measureid) - colocated_partitioned_table_2020_01_01_8999012 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999012 ON citus_split_test_schema_partitioned.colocated_partitioned_table_2020_01_01_8999012 USING btree (measureid, eventdatetime) - colocated_partitioned_table_8999010 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999010 ON ONLY citus_split_test_schema_partitioned.colocated_partitioned_table_8999010 USING btree (measureid, eventdatetime) - reference_table_8970007 | CREATE UNIQUE INDEX reference_table_pkey_8970007 ON citus_split_test_schema_partitioned.reference_table_8970007 USING btree (measureid) - sensors_2020_01_01_8999004 | CREATE INDEX index_on_child_8999004 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999004 USING btree (lower((measure_data)::text)) - sensors_2020_01_01_8999004 | CREATE INDEX sensors_2020_01_01_lower_idx_8999004 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999004 USING btree (lower((measureid)::text)) - sensors_2020_01_01_8999004 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999004 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999004 USING btree (measureid, eventdatetime, measure_data) - sensors_8999000 | CREATE INDEX index_on_parent_8999000 ON ONLY citus_split_test_schema_partitioned.sensors_8999000 USING btree (lower((measureid)::text)) - sensors_8999000 | CREATE UNIQUE INDEX sensors_pkey_8999000 ON ONLY citus_split_test_schema_partitioned.sensors_8999000 USING btree (measureid, eventdatetime, measure_data) - sensors_news_8999006 | CREATE INDEX sensors_news_lower_idx_8999006 ON citus_split_test_schema_partitioned.sensors_news_8999006 USING btree (lower((measureid)::text)) - sensors_news_8999006 | CREATE UNIQUE INDEX sensors_news_pkey_8999006 ON citus_split_test_schema_partitioned.sensors_news_8999006 USING btree (measureid, eventdatetime, measure_data) - sensors_old_8999002 | CREATE INDEX sensors_old_lower_idx_8999002 ON citus_split_test_schema_partitioned.sensors_old_8999002 USING btree (lower((measureid)::text)) - sensors_old_8999002 | CREATE UNIQUE INDEX sensors_old_pkey_8999002 ON citus_split_test_schema_partitioned.sensors_old_8999002 USING btree (measureid, eventdatetime, measure_data) -(13 rows) + colocated_dist_table_8999016 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999016 ON citus_split_test_schema_columnar_partitioned.colocated_dist_table_8999016 USING btree (measureid) + colocated_partitioned_table_2020_01_01_8999020 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999020 ON citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_2020_01_01_8999020 USING btree (measureid, eventdatetime) + colocated_partitioned_table_8999018 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999018 ON ONLY citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_8999018 USING btree (measureid, eventdatetime) + reference_table_8970011 | CREATE UNIQUE INDEX reference_table_pkey_8970011 ON citus_split_test_schema_columnar_partitioned.reference_table_8970011 USING btree (measureid) + sensors_2020_01_01_8999004 | CREATE INDEX index_on_child_8999004 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999004 USING btree (lower((measure_data)::text)) + sensors_2020_01_01_8999004 | CREATE INDEX sensors_2020_01_01_lower_idx_8999004 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999004 USING btree (lower((measureid)::text)) + sensors_2020_01_01_8999004 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999004 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999004 USING btree (measureid, eventdatetime, measure_data) + sensors_8999000 | CREATE INDEX index_on_parent_8999000 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999000 USING btree (lower((measureid)::text)) + sensors_8999000 | CREATE UNIQUE INDEX sensors_pkey_8999000 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999000 USING btree (measureid, eventdatetime, measure_data) + sensors_news_8999006 | CREATE INDEX sensors_news_lower_idx_8999006 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999006 USING btree (lower((measureid)::text)) + sensors_news_8999006 | CREATE UNIQUE INDEX sensors_news_pkey_8999006 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999006 USING btree (measureid, eventdatetime, measure_data) + sensors_old_8999002 | CREATE INDEX sensors_old_lower_idx_8999002 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999002 USING btree (lower((measureid)::text)) + sensors_old_8999002 | CREATE UNIQUE INDEX sensors_old_pkey_8999002 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999002 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_2020_01_01_8999012 | CREATE INDEX index_on_child_columnar_8999012 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999012 USING btree (lower((measure_data)::text)) + sensorscolumnar_2020_01_01_8999012 | CREATE INDEX sensorscolumnar_2020_01_01_lower_idx_8999012 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999012 USING btree (lower((measureid)::text)) + sensorscolumnar_2020_01_01_8999012 | CREATE UNIQUE INDEX sensorscolumnar_2020_01_01_pkey_8999012 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999012 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_8999008 | CREATE INDEX index_on_parent_columnar_8999008 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999008 USING btree (lower((measureid)::text)) + sensorscolumnar_8999008 | CREATE UNIQUE INDEX sensorscolumnar_pkey_8999008 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999008 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_news_8999014 | CREATE INDEX sensorscolumnar_news_lower_idx_8999014 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999014 USING btree (lower((measureid)::text)) + sensorscolumnar_news_8999014 | CREATE UNIQUE INDEX sensorscolumnar_news_pkey_8999014 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999014 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_old_8999010 | CREATE INDEX sensorscolumnar_old_lower_idx_8999010 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999010 USING btree (lower((measureid)::text)) + sensorscolumnar_old_8999010 | CREATE UNIQUE INDEX sensorscolumnar_old_pkey_8999010 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999010 USING btree (measureid, eventdatetime, measure_data) +(22 rows) SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; - stxname + stxname --------------------------------------------------------------------- s1 s1_8999000 + s1_c + s1_c_8999008 s2 s2_8999004 -(4 rows) + s2_c + s2_c_8999012 +(8 rows) \c - - - :worker_2_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -355,67 +424,80 @@ SET citus.shard_replication_factor TO 1; ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999005 | fkey_from_child_to_child_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_dist_8999005 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_parent_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_ref_8999005 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999005 | sensors_2020_01_01_8999005_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_8999001 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_8999001 | sensors_8999001_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_news_8999007 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_old_8999003 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_old_8999003 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) + sensors_2020_01_01_8999005 | fkey_from_child_to_child_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | fkey_from_child_to_dist_8999005 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | fkey_from_child_to_parent_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | fkey_from_child_to_ref_8999005 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | sensors_2020_01_01_8999005_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_8999001 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_8999001 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999001 | sensors_8999001_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_news_8999007 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_news_8999007 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_news_8999007 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_news_8999007 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999003 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_old_8999003 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_old_8999003 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_old_8999003 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; - tablename | indexdef + tablename | indexdef --------------------------------------------------------------------- - colocated_dist_table_8999009 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999009 ON citus_split_test_schema_partitioned.colocated_dist_table_8999009 USING btree (measureid) - colocated_partitioned_table_2020_01_01_8999013 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999013 ON citus_split_test_schema_partitioned.colocated_partitioned_table_2020_01_01_8999013 USING btree (measureid, eventdatetime) - colocated_partitioned_table_8999011 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999011 ON ONLY citus_split_test_schema_partitioned.colocated_partitioned_table_8999011 USING btree (measureid, eventdatetime) - reference_table_8970007 | CREATE UNIQUE INDEX reference_table_pkey_8970007 ON citus_split_test_schema_partitioned.reference_table_8970007 USING btree (measureid) - sensors_2020_01_01_8999005 | CREATE INDEX index_on_child_8999005 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999005 USING btree (lower((measure_data)::text)) - sensors_2020_01_01_8999005 | CREATE INDEX sensors_2020_01_01_lower_idx_8999005 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999005 USING btree (lower((measureid)::text)) - sensors_2020_01_01_8999005 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999005 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999005 USING btree (measureid, eventdatetime, measure_data) - sensors_8999001 | CREATE INDEX index_on_parent_8999001 ON ONLY citus_split_test_schema_partitioned.sensors_8999001 USING btree (lower((measureid)::text)) - sensors_8999001 | CREATE UNIQUE INDEX sensors_pkey_8999001 ON ONLY citus_split_test_schema_partitioned.sensors_8999001 USING btree (measureid, eventdatetime, measure_data) - sensors_news_8999007 | CREATE INDEX sensors_news_lower_idx_8999007 ON citus_split_test_schema_partitioned.sensors_news_8999007 USING btree (lower((measureid)::text)) - sensors_news_8999007 | CREATE UNIQUE INDEX sensors_news_pkey_8999007 ON citus_split_test_schema_partitioned.sensors_news_8999007 USING btree (measureid, eventdatetime, measure_data) - sensors_old_8999003 | CREATE INDEX sensors_old_lower_idx_8999003 ON citus_split_test_schema_partitioned.sensors_old_8999003 USING btree (lower((measureid)::text)) - sensors_old_8999003 | CREATE UNIQUE INDEX sensors_old_pkey_8999003 ON citus_split_test_schema_partitioned.sensors_old_8999003 USING btree (measureid, eventdatetime, measure_data) -(13 rows) + colocated_dist_table_8999017 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999017 ON citus_split_test_schema_columnar_partitioned.colocated_dist_table_8999017 USING btree (measureid) + colocated_partitioned_table_2020_01_01_8999021 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999021 ON citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_2020_01_01_8999021 USING btree (measureid, eventdatetime) + colocated_partitioned_table_8999019 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999019 ON ONLY citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_8999019 USING btree (measureid, eventdatetime) + reference_table_8970011 | CREATE UNIQUE INDEX reference_table_pkey_8970011 ON citus_split_test_schema_columnar_partitioned.reference_table_8970011 USING btree (measureid) + sensors_2020_01_01_8999005 | CREATE INDEX index_on_child_8999005 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999005 USING btree (lower((measure_data)::text)) + sensors_2020_01_01_8999005 | CREATE INDEX sensors_2020_01_01_lower_idx_8999005 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999005 USING btree (lower((measureid)::text)) + sensors_2020_01_01_8999005 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999005 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999005 USING btree (measureid, eventdatetime, measure_data) + sensors_8999001 | CREATE INDEX index_on_parent_8999001 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999001 USING btree (lower((measureid)::text)) + sensors_8999001 | CREATE UNIQUE INDEX sensors_pkey_8999001 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999001 USING btree (measureid, eventdatetime, measure_data) + sensors_news_8999007 | CREATE INDEX sensors_news_lower_idx_8999007 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999007 USING btree (lower((measureid)::text)) + sensors_news_8999007 | CREATE UNIQUE INDEX sensors_news_pkey_8999007 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999007 USING btree (measureid, eventdatetime, measure_data) + sensors_old_8999003 | CREATE INDEX sensors_old_lower_idx_8999003 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999003 USING btree (lower((measureid)::text)) + sensors_old_8999003 | CREATE UNIQUE INDEX sensors_old_pkey_8999003 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999003 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_2020_01_01_8999013 | CREATE INDEX index_on_child_columnar_8999013 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999013 USING btree (lower((measure_data)::text)) + sensorscolumnar_2020_01_01_8999013 | CREATE INDEX sensorscolumnar_2020_01_01_lower_idx_8999013 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999013 USING btree (lower((measureid)::text)) + sensorscolumnar_2020_01_01_8999013 | CREATE UNIQUE INDEX sensorscolumnar_2020_01_01_pkey_8999013 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999013 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_8999009 | CREATE INDEX index_on_parent_columnar_8999009 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999009 USING btree (lower((measureid)::text)) + sensorscolumnar_8999009 | CREATE UNIQUE INDEX sensorscolumnar_pkey_8999009 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999009 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_news_8999015 | CREATE INDEX sensorscolumnar_news_lower_idx_8999015 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999015 USING btree (lower((measureid)::text)) + sensorscolumnar_news_8999015 | CREATE UNIQUE INDEX sensorscolumnar_news_pkey_8999015 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999015 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_old_8999011 | CREATE INDEX sensorscolumnar_old_lower_idx_8999011 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999011 USING btree (lower((measureid)::text)) + sensorscolumnar_old_8999011 | CREATE UNIQUE INDEX sensorscolumnar_old_pkey_8999011 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999011 USING btree (measureid, eventdatetime, measure_data) +(22 rows) SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; - stxname + stxname --------------------------------------------------------------------- s1 s1_8999001 + s1_c + s1_c_8999009 s2 s2_8999005 -(4 rows) + s2_c + s2_c_8999013 +(8 rows) -- END: Show the updated state on workers -- BEGIN: Split a partition table directly \c - - - :master_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.next_shard_id TO 8999100; SELECT nodeid AS worker_1_node FROM pg_dist_node WHERE nodeport=:worker_1_port \gset SELECT nodeid AS worker_2_node FROM pg_dist_node WHERE nodeport=:worker_2_port \gset @@ -423,7 +505,7 @@ SET citus.shard_replication_factor TO 1; 8999002, -- sensors_old ARRAY['-2127770000'], ARRAY[:worker_1_node, :worker_2_node], - 'force_logical'); + 'auto'); citus_split_shard_by_split_points --------------------------------------------------------------------- @@ -437,13 +519,16 @@ SET citus.shard_replication_factor TO 1; INNER JOIN pg_dist_node node ON placement.groupid = node.groupid INNER JOIN pg_catalog.pg_class cls ON shard.logicalrelid = cls.oid INNER JOIN pg_catalog.pg_namespace ns ON cls.relnamespace = ns.oid - WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_partitioned' - ORDER BY logicalrelid, shardminvalue::BIGINT; + WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_columnar_partitioned' + ORDER BY logicalrelid, shardminvalue::BIGINT, nodeport; shardid | logicalrelid | shardminvalue | shardmaxvalue | nodename | nodeport --------------------------------------------------------------------- 8999100 | sensors | -2147483648 | -2127770000 | localhost | 57637 8999101 | sensors | -2127769999 | -2120000000 | localhost | 57638 8999001 | sensors | -2119999999 | 2147483647 | localhost | 57638 + 8999108 | sensorscolumnar | -2147483648 | -2127770000 | localhost | 57637 + 8999109 | sensorscolumnar | -2127769999 | -2120000000 | localhost | 57638 + 8999009 | sensorscolumnar | -2119999999 | 2147483647 | localhost | 57638 8999102 | sensors_old | -2147483648 | -2127770000 | localhost | 57637 8999103 | sensors_old | -2127769999 | -2120000000 | localhost | 57638 8999003 | sensors_old | -2119999999 | 2147483647 | localhost | 57638 @@ -453,18 +538,27 @@ SET citus.shard_replication_factor TO 1; 8999106 | sensors_news | -2147483648 | -2127770000 | localhost | 57637 8999107 | sensors_news | -2127769999 | -2120000000 | localhost | 57638 8999007 | sensors_news | -2119999999 | 2147483647 | localhost | 57638 - 8999108 | colocated_dist_table | -2147483648 | -2127770000 | localhost | 57637 - 8999109 | colocated_dist_table | -2127769999 | -2120000000 | localhost | 57638 - 8999009 | colocated_dist_table | -2119999999 | 2147483647 | localhost | 57638 - 8999110 | colocated_partitioned_table | -2147483648 | -2127770000 | localhost | 57637 - 8999111 | colocated_partitioned_table | -2127769999 | -2120000000 | localhost | 57638 - 8999011 | colocated_partitioned_table | -2119999999 | 2147483647 | localhost | 57638 - 8999112 | colocated_partitioned_table_2020_01_01 | -2147483648 | -2127770000 | localhost | 57637 - 8999113 | colocated_partitioned_table_2020_01_01 | -2127769999 | -2120000000 | localhost | 57638 - 8999013 | colocated_partitioned_table_2020_01_01 | -2119999999 | 2147483647 | localhost | 57638 - 8970007 | reference_table | | | localhost | 57637 - 8970007 | reference_table | | | localhost | 57638 -(23 rows) + 8999110 | sensorscolumnar_old | -2147483648 | -2127770000 | localhost | 57637 + 8999111 | sensorscolumnar_old | -2127769999 | -2120000000 | localhost | 57638 + 8999011 | sensorscolumnar_old | -2119999999 | 2147483647 | localhost | 57638 + 8999112 | sensorscolumnar_2020_01_01 | -2147483648 | -2127770000 | localhost | 57637 + 8999113 | sensorscolumnar_2020_01_01 | -2127769999 | -2120000000 | localhost | 57638 + 8999013 | sensorscolumnar_2020_01_01 | -2119999999 | 2147483647 | localhost | 57638 + 8999114 | sensorscolumnar_news | -2147483648 | -2127770000 | localhost | 57637 + 8999115 | sensorscolumnar_news | -2127769999 | -2120000000 | localhost | 57638 + 8999015 | sensorscolumnar_news | -2119999999 | 2147483647 | localhost | 57638 + 8999116 | colocated_dist_table | -2147483648 | -2127770000 | localhost | 57637 + 8999117 | colocated_dist_table | -2127769999 | -2120000000 | localhost | 57638 + 8999017 | colocated_dist_table | -2119999999 | 2147483647 | localhost | 57638 + 8999118 | colocated_partitioned_table | -2147483648 | -2127770000 | localhost | 57637 + 8999119 | colocated_partitioned_table | -2127769999 | -2120000000 | localhost | 57638 + 8999019 | colocated_partitioned_table | -2119999999 | 2147483647 | localhost | 57638 + 8999120 | colocated_partitioned_table_2020_01_01 | -2147483648 | -2127770000 | localhost | 57637 + 8999121 | colocated_partitioned_table_2020_01_01 | -2127769999 | -2120000000 | localhost | 57638 + 8999021 | colocated_partitioned_table_2020_01_01 | -2119999999 | 2147483647 | localhost | 57638 + 8970011 | reference_table | | | localhost | 57637 + 8970011 | reference_table | | | localhost | 57638 +(35 rows) SELECT count(*) FROM reference_table; count @@ -490,10 +584,16 @@ SET citus.shard_replication_factor TO 1; 1001 (1 row) + SELECT count(*) FROM sensorscolumnar; + count +--------------------------------------------------------------------- + 1001 +(1 row) + -- END: Validate Shard Info and Data -- BEGIN: Show the updated state on workers \c - - - :worker_1_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -502,65 +602,78 @@ SET citus.shard_replication_factor TO 1; ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999104 | fkey_from_child_to_child_8999104 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999112(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_child_to_dist_8999104 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999108(measureid) - sensors_2020_01_01_8999104 | fkey_from_child_to_parent_8999104 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999110(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_child_to_ref_8999104 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999112(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999108(measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999110(eventdatetime, measureid) - sensors_2020_01_01_8999104 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999104 | sensors_2020_01_01_8999104_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999112(eventdatetime, measureid) - sensors_8999100 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999112(eventdatetime, measureid) - sensors_8999100 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999108(measureid) - sensors_8999100 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999110(eventdatetime, measureid) - sensors_8999100 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_8999100 | sensors_8999100_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999112(eventdatetime, measureid) - sensors_news_8999106 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999112(eventdatetime, measureid) - sensors_news_8999106 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999108(measureid) - sensors_news_8999106 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999110(eventdatetime, measureid) - sensors_news_8999106 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_old_8999102 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999112(eventdatetime, measureid) - sensors_old_8999102 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999108(measureid) - sensors_old_8999102 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999110(eventdatetime, measureid) - sensors_old_8999102 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) + sensors_2020_01_01_8999104 | fkey_from_child_to_child_8999104 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_2020_01_01_8999104 | fkey_from_child_to_dist_8999104 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_2020_01_01_8999104 | fkey_from_child_to_parent_8999104 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_2020_01_01_8999104 | fkey_from_child_to_ref_8999104 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999104 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_2020_01_01_8999104 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_2020_01_01_8999104 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_2020_01_01_8999104 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999104 | sensors_2020_01_01_8999104_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_8999100 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_8999100 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_8999100 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_8999100 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999100 | sensors_8999100_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_news_8999106 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_news_8999106 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_news_8999106 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_news_8999106 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999102 | fkey_from_parent_to_child_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999120(eventdatetime, measureid) + sensors_old_8999102 | fkey_from_parent_to_dist_8999100 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999116(measureid) + sensors_old_8999102 | fkey_from_parent_to_parent_8999100 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999118(eventdatetime, measureid) + sensors_old_8999102 | fkey_from_parent_to_ref_8999100 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (22 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; - tablename | indexdef + tablename | indexdef --------------------------------------------------------------------- - colocated_dist_table_8999108 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999108 ON citus_split_test_schema_partitioned.colocated_dist_table_8999108 USING btree (measureid) - colocated_partitioned_table_2020_01_01_8999112 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999112 ON citus_split_test_schema_partitioned.colocated_partitioned_table_2020_01_01_8999112 USING btree (measureid, eventdatetime) - colocated_partitioned_table_8999110 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999110 ON ONLY citus_split_test_schema_partitioned.colocated_partitioned_table_8999110 USING btree (measureid, eventdatetime) - reference_table_8970007 | CREATE UNIQUE INDEX reference_table_pkey_8970007 ON citus_split_test_schema_partitioned.reference_table_8970007 USING btree (measureid) - sensors_2020_01_01_8999104 | CREATE INDEX index_on_child_8999104 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999104 USING btree (lower((measure_data)::text)) - sensors_2020_01_01_8999104 | CREATE INDEX sensors_2020_01_01_lower_idx_8999104 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999104 USING btree (lower((measureid)::text)) - sensors_2020_01_01_8999104 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999104 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999104 USING btree (measureid, eventdatetime, measure_data) - sensors_8999100 | CREATE INDEX index_on_parent_8999100 ON ONLY citus_split_test_schema_partitioned.sensors_8999100 USING btree (lower((measureid)::text)) - sensors_8999100 | CREATE UNIQUE INDEX sensors_pkey_8999100 ON ONLY citus_split_test_schema_partitioned.sensors_8999100 USING btree (measureid, eventdatetime, measure_data) - sensors_news_8999106 | CREATE INDEX sensors_news_lower_idx_8999106 ON citus_split_test_schema_partitioned.sensors_news_8999106 USING btree (lower((measureid)::text)) - sensors_news_8999106 | CREATE UNIQUE INDEX sensors_news_pkey_8999106 ON citus_split_test_schema_partitioned.sensors_news_8999106 USING btree (measureid, eventdatetime, measure_data) - sensors_old_8999102 | CREATE INDEX sensors_old_lower_idx_8999102 ON citus_split_test_schema_partitioned.sensors_old_8999102 USING btree (lower((measureid)::text)) - sensors_old_8999102 | CREATE UNIQUE INDEX sensors_old_pkey_8999102 ON citus_split_test_schema_partitioned.sensors_old_8999102 USING btree (measureid, eventdatetime, measure_data) -(13 rows) + colocated_dist_table_8999116 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999116 ON citus_split_test_schema_columnar_partitioned.colocated_dist_table_8999116 USING btree (measureid) + colocated_partitioned_table_2020_01_01_8999120 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999120 ON citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_2020_01_01_8999120 USING btree (measureid, eventdatetime) + colocated_partitioned_table_8999118 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999118 ON ONLY citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_8999118 USING btree (measureid, eventdatetime) + reference_table_8970011 | CREATE UNIQUE INDEX reference_table_pkey_8970011 ON citus_split_test_schema_columnar_partitioned.reference_table_8970011 USING btree (measureid) + sensors_2020_01_01_8999104 | CREATE INDEX index_on_child_8999104 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999104 USING btree (lower((measure_data)::text)) + sensors_2020_01_01_8999104 | CREATE INDEX sensors_2020_01_01_lower_idx_8999104 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999104 USING btree (lower((measureid)::text)) + sensors_2020_01_01_8999104 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999104 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999104 USING btree (measureid, eventdatetime, measure_data) + sensors_8999100 | CREATE INDEX index_on_parent_8999100 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999100 USING btree (lower((measureid)::text)) + sensors_8999100 | CREATE UNIQUE INDEX sensors_pkey_8999100 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999100 USING btree (measureid, eventdatetime, measure_data) + sensors_news_8999106 | CREATE INDEX sensors_news_lower_idx_8999106 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999106 USING btree (lower((measureid)::text)) + sensors_news_8999106 | CREATE UNIQUE INDEX sensors_news_pkey_8999106 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999106 USING btree (measureid, eventdatetime, measure_data) + sensors_old_8999102 | CREATE INDEX sensors_old_lower_idx_8999102 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999102 USING btree (lower((measureid)::text)) + sensors_old_8999102 | CREATE UNIQUE INDEX sensors_old_pkey_8999102 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999102 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_2020_01_01_8999112 | CREATE INDEX index_on_child_columnar_8999112 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999112 USING btree (lower((measure_data)::text)) + sensorscolumnar_2020_01_01_8999112 | CREATE INDEX sensorscolumnar_2020_01_01_lower_idx_8999112 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999112 USING btree (lower((measureid)::text)) + sensorscolumnar_2020_01_01_8999112 | CREATE UNIQUE INDEX sensorscolumnar_2020_01_01_pkey_8999112 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999112 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_8999108 | CREATE INDEX index_on_parent_columnar_8999108 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999108 USING btree (lower((measureid)::text)) + sensorscolumnar_8999108 | CREATE UNIQUE INDEX sensorscolumnar_pkey_8999108 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999108 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_news_8999114 | CREATE INDEX sensorscolumnar_news_lower_idx_8999114 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999114 USING btree (lower((measureid)::text)) + sensorscolumnar_news_8999114 | CREATE UNIQUE INDEX sensorscolumnar_news_pkey_8999114 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999114 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_old_8999110 | CREATE INDEX sensorscolumnar_old_lower_idx_8999110 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999110 USING btree (lower((measureid)::text)) + sensorscolumnar_old_8999110 | CREATE UNIQUE INDEX sensorscolumnar_old_pkey_8999110 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999110 USING btree (measureid, eventdatetime, measure_data) +(22 rows) SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; - stxname + stxname --------------------------------------------------------------------- s1 s1_8999100 + s1_c + s1_c_8999108 s2 s2_8999104 -(4 rows) + s2_c + s2_c_8999112 +(8 rows) \c - - - :worker_2_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -569,106 +682,131 @@ SET citus.shard_replication_factor TO 1; ORDER BY 1, 2; relname | Constraint | Definition --------------------------------------------------------------------- - sensors_2020_01_01_8999005 | fkey_from_child_to_child_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_dist_8999005 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_parent_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_child_to_ref_8999005 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_2020_01_01_8999005 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999005 | sensors_2020_01_01_8999005_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_child_8999105 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999113(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_dist_8999105 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999109(measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_parent_8999105 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999111(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_child_to_ref_8999105 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999113(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999109(measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999111(eventdatetime, measureid) - sensors_2020_01_01_8999105 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_2020_01_01_8999105 | sensors_2020_01_01_8999105_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999113(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_8999001 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_8999001 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_8999001 | sensors_8999001_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_8999101 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999113(eventdatetime, measureid) - sensors_8999101 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999109(measureid) - sensors_8999101 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999111(eventdatetime, measureid) - sensors_8999101 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_8999101 | sensors_8999101_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999113(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_news_8999007 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_news_8999007 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_news_8999107 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999113(eventdatetime, measureid) - sensors_news_8999107 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999109(measureid) - sensors_news_8999107 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999111(eventdatetime, measureid) - sensors_news_8999107 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_old_8999003 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999013(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999009(measureid) - sensors_old_8999003 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999011(eventdatetime, measureid) - sensors_old_8999003 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) - sensors_old_8999103 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999113(eventdatetime, measureid) - sensors_old_8999103 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999109(measureid) - sensors_old_8999103 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999111(eventdatetime, measureid) - sensors_old_8999103 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970007(measureid) + sensors_2020_01_01_8999005 | fkey_from_child_to_child_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | fkey_from_child_to_dist_8999005 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | fkey_from_child_to_parent_8999005 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | fkey_from_child_to_ref_8999005 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999005 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_2020_01_01_8999005 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_2020_01_01_8999005 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999005 | sensors_2020_01_01_8999005_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_2020_01_01_8999105 | fkey_from_child_to_child_8999105 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_2020_01_01_8999105 | fkey_from_child_to_dist_8999105 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_2020_01_01_8999105 | fkey_from_child_to_parent_8999105 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_2020_01_01_8999105 | fkey_from_child_to_ref_8999105 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999105 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_2020_01_01_8999105 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_2020_01_01_8999105 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_2020_01_01_8999105 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_2020_01_01_8999105 | sensors_2020_01_01_8999105_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_8999001 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999001 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_8999001 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_8999001 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999001 | sensors_8999001_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_8999101 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_8999101 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_8999101 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_8999101 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_8999101 | sensors_8999101_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_news_8999007 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_news_8999007 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_news_8999007 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_news_8999007 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_news_8999107 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_news_8999107 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_news_8999107 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_news_8999107 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999003 | fkey_from_parent_to_child_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999021(eventdatetime, measureid) + sensors_old_8999003 | fkey_from_parent_to_dist_8999001 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999017(measureid) + sensors_old_8999003 | fkey_from_parent_to_parent_8999001 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999019(eventdatetime, measureid) + sensors_old_8999003 | fkey_from_parent_to_ref_8999001 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) + sensors_old_8999103 | fkey_from_parent_to_child_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8999121(eventdatetime, measureid) + sensors_old_8999103 | fkey_from_parent_to_dist_8999101 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8999117(measureid) + sensors_old_8999103 | fkey_from_parent_to_parent_8999101 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8999119(eventdatetime, measureid) + sensors_old_8999103 | fkey_from_parent_to_ref_8999101 | FOREIGN KEY (measureid) REFERENCES reference_table_8970011(measureid) (44 rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename like '%_89%' ORDER BY 1,2; - tablename | indexdef + tablename | indexdef --------------------------------------------------------------------- - colocated_dist_table_8999009 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999009 ON citus_split_test_schema_partitioned.colocated_dist_table_8999009 USING btree (measureid) - colocated_dist_table_8999109 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999109 ON citus_split_test_schema_partitioned.colocated_dist_table_8999109 USING btree (measureid) - colocated_partitioned_table_2020_01_01_8999013 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999013 ON citus_split_test_schema_partitioned.colocated_partitioned_table_2020_01_01_8999013 USING btree (measureid, eventdatetime) - colocated_partitioned_table_2020_01_01_8999113 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999113 ON citus_split_test_schema_partitioned.colocated_partitioned_table_2020_01_01_8999113 USING btree (measureid, eventdatetime) - colocated_partitioned_table_8999011 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999011 ON ONLY citus_split_test_schema_partitioned.colocated_partitioned_table_8999011 USING btree (measureid, eventdatetime) - colocated_partitioned_table_8999111 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999111 ON ONLY citus_split_test_schema_partitioned.colocated_partitioned_table_8999111 USING btree (measureid, eventdatetime) - reference_table_8970007 | CREATE UNIQUE INDEX reference_table_pkey_8970007 ON citus_split_test_schema_partitioned.reference_table_8970007 USING btree (measureid) - sensors_2020_01_01_8999005 | CREATE INDEX index_on_child_8999005 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999005 USING btree (lower((measure_data)::text)) - sensors_2020_01_01_8999005 | CREATE INDEX sensors_2020_01_01_lower_idx_8999005 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999005 USING btree (lower((measureid)::text)) - sensors_2020_01_01_8999005 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999005 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999005 USING btree (measureid, eventdatetime, measure_data) - sensors_2020_01_01_8999105 | CREATE INDEX index_on_child_8999105 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999105 USING btree (lower((measure_data)::text)) - sensors_2020_01_01_8999105 | CREATE INDEX sensors_2020_01_01_lower_idx_8999105 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999105 USING btree (lower((measureid)::text)) - sensors_2020_01_01_8999105 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999105 ON citus_split_test_schema_partitioned.sensors_2020_01_01_8999105 USING btree (measureid, eventdatetime, measure_data) - sensors_8999001 | CREATE INDEX index_on_parent_8999001 ON ONLY citus_split_test_schema_partitioned.sensors_8999001 USING btree (lower((measureid)::text)) - sensors_8999001 | CREATE UNIQUE INDEX sensors_pkey_8999001 ON ONLY citus_split_test_schema_partitioned.sensors_8999001 USING btree (measureid, eventdatetime, measure_data) - sensors_8999101 | CREATE INDEX index_on_parent_8999101 ON ONLY citus_split_test_schema_partitioned.sensors_8999101 USING btree (lower((measureid)::text)) - sensors_8999101 | CREATE UNIQUE INDEX sensors_pkey_8999101 ON ONLY citus_split_test_schema_partitioned.sensors_8999101 USING btree (measureid, eventdatetime, measure_data) - sensors_news_8999007 | CREATE INDEX sensors_news_lower_idx_8999007 ON citus_split_test_schema_partitioned.sensors_news_8999007 USING btree (lower((measureid)::text)) - sensors_news_8999007 | CREATE UNIQUE INDEX sensors_news_pkey_8999007 ON citus_split_test_schema_partitioned.sensors_news_8999007 USING btree (measureid, eventdatetime, measure_data) - sensors_news_8999107 | CREATE INDEX sensors_news_lower_idx_8999107 ON citus_split_test_schema_partitioned.sensors_news_8999107 USING btree (lower((measureid)::text)) - sensors_news_8999107 | CREATE UNIQUE INDEX sensors_news_pkey_8999107 ON citus_split_test_schema_partitioned.sensors_news_8999107 USING btree (measureid, eventdatetime, measure_data) - sensors_old_8999003 | CREATE INDEX sensors_old_lower_idx_8999003 ON citus_split_test_schema_partitioned.sensors_old_8999003 USING btree (lower((measureid)::text)) - sensors_old_8999003 | CREATE UNIQUE INDEX sensors_old_pkey_8999003 ON citus_split_test_schema_partitioned.sensors_old_8999003 USING btree (measureid, eventdatetime, measure_data) - sensors_old_8999103 | CREATE INDEX sensors_old_lower_idx_8999103 ON citus_split_test_schema_partitioned.sensors_old_8999103 USING btree (lower((measureid)::text)) - sensors_old_8999103 | CREATE UNIQUE INDEX sensors_old_pkey_8999103 ON citus_split_test_schema_partitioned.sensors_old_8999103 USING btree (measureid, eventdatetime, measure_data) -(25 rows) + colocated_dist_table_8999017 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999017 ON citus_split_test_schema_columnar_partitioned.colocated_dist_table_8999017 USING btree (measureid) + colocated_dist_table_8999117 | CREATE UNIQUE INDEX colocated_dist_table_pkey_8999117 ON citus_split_test_schema_columnar_partitioned.colocated_dist_table_8999117 USING btree (measureid) + colocated_partitioned_table_2020_01_01_8999021 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999021 ON citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_2020_01_01_8999021 USING btree (measureid, eventdatetime) + colocated_partitioned_table_2020_01_01_8999121 | CREATE UNIQUE INDEX colocated_partitioned_table_2020_01_01_pkey_8999121 ON citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_2020_01_01_8999121 USING btree (measureid, eventdatetime) + colocated_partitioned_table_8999019 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999019 ON ONLY citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_8999019 USING btree (measureid, eventdatetime) + colocated_partitioned_table_8999119 | CREATE UNIQUE INDEX colocated_partitioned_table_pkey_8999119 ON ONLY citus_split_test_schema_columnar_partitioned.colocated_partitioned_table_8999119 USING btree (measureid, eventdatetime) + reference_table_8970011 | CREATE UNIQUE INDEX reference_table_pkey_8970011 ON citus_split_test_schema_columnar_partitioned.reference_table_8970011 USING btree (measureid) + sensors_2020_01_01_8999005 | CREATE INDEX index_on_child_8999005 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999005 USING btree (lower((measure_data)::text)) + sensors_2020_01_01_8999005 | CREATE INDEX sensors_2020_01_01_lower_idx_8999005 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999005 USING btree (lower((measureid)::text)) + sensors_2020_01_01_8999005 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999005 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999005 USING btree (measureid, eventdatetime, measure_data) + sensors_2020_01_01_8999105 | CREATE INDEX index_on_child_8999105 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999105 USING btree (lower((measure_data)::text)) + sensors_2020_01_01_8999105 | CREATE INDEX sensors_2020_01_01_lower_idx_8999105 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999105 USING btree (lower((measureid)::text)) + sensors_2020_01_01_8999105 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8999105 ON citus_split_test_schema_columnar_partitioned.sensors_2020_01_01_8999105 USING btree (measureid, eventdatetime, measure_data) + sensors_8999001 | CREATE INDEX index_on_parent_8999001 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999001 USING btree (lower((measureid)::text)) + sensors_8999001 | CREATE UNIQUE INDEX sensors_pkey_8999001 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999001 USING btree (measureid, eventdatetime, measure_data) + sensors_8999101 | CREATE INDEX index_on_parent_8999101 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999101 USING btree (lower((measureid)::text)) + sensors_8999101 | CREATE UNIQUE INDEX sensors_pkey_8999101 ON ONLY citus_split_test_schema_columnar_partitioned.sensors_8999101 USING btree (measureid, eventdatetime, measure_data) + sensors_news_8999007 | CREATE INDEX sensors_news_lower_idx_8999007 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999007 USING btree (lower((measureid)::text)) + sensors_news_8999007 | CREATE UNIQUE INDEX sensors_news_pkey_8999007 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999007 USING btree (measureid, eventdatetime, measure_data) + sensors_news_8999107 | CREATE INDEX sensors_news_lower_idx_8999107 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999107 USING btree (lower((measureid)::text)) + sensors_news_8999107 | CREATE UNIQUE INDEX sensors_news_pkey_8999107 ON citus_split_test_schema_columnar_partitioned.sensors_news_8999107 USING btree (measureid, eventdatetime, measure_data) + sensors_old_8999003 | CREATE INDEX sensors_old_lower_idx_8999003 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999003 USING btree (lower((measureid)::text)) + sensors_old_8999003 | CREATE UNIQUE INDEX sensors_old_pkey_8999003 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999003 USING btree (measureid, eventdatetime, measure_data) + sensors_old_8999103 | CREATE INDEX sensors_old_lower_idx_8999103 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999103 USING btree (lower((measureid)::text)) + sensors_old_8999103 | CREATE UNIQUE INDEX sensors_old_pkey_8999103 ON citus_split_test_schema_columnar_partitioned.sensors_old_8999103 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_2020_01_01_8999013 | CREATE INDEX index_on_child_columnar_8999013 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999013 USING btree (lower((measure_data)::text)) + sensorscolumnar_2020_01_01_8999013 | CREATE INDEX sensorscolumnar_2020_01_01_lower_idx_8999013 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999013 USING btree (lower((measureid)::text)) + sensorscolumnar_2020_01_01_8999013 | CREATE UNIQUE INDEX sensorscolumnar_2020_01_01_pkey_8999013 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999013 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_2020_01_01_8999113 | CREATE INDEX index_on_child_columnar_8999113 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999113 USING btree (lower((measure_data)::text)) + sensorscolumnar_2020_01_01_8999113 | CREATE INDEX sensorscolumnar_2020_01_01_lower_idx_8999113 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999113 USING btree (lower((measureid)::text)) + sensorscolumnar_2020_01_01_8999113 | CREATE UNIQUE INDEX sensorscolumnar_2020_01_01_pkey_8999113 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_2020_01_01_8999113 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_8999009 | CREATE INDEX index_on_parent_columnar_8999009 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999009 USING btree (lower((measureid)::text)) + sensorscolumnar_8999009 | CREATE UNIQUE INDEX sensorscolumnar_pkey_8999009 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999009 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_8999109 | CREATE INDEX index_on_parent_columnar_8999109 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999109 USING btree (lower((measureid)::text)) + sensorscolumnar_8999109 | CREATE UNIQUE INDEX sensorscolumnar_pkey_8999109 ON ONLY citus_split_test_schema_columnar_partitioned.sensorscolumnar_8999109 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_news_8999015 | CREATE INDEX sensorscolumnar_news_lower_idx_8999015 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999015 USING btree (lower((measureid)::text)) + sensorscolumnar_news_8999015 | CREATE UNIQUE INDEX sensorscolumnar_news_pkey_8999015 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999015 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_news_8999115 | CREATE INDEX sensorscolumnar_news_lower_idx_8999115 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999115 USING btree (lower((measureid)::text)) + sensorscolumnar_news_8999115 | CREATE UNIQUE INDEX sensorscolumnar_news_pkey_8999115 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_news_8999115 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_old_8999011 | CREATE INDEX sensorscolumnar_old_lower_idx_8999011 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999011 USING btree (lower((measureid)::text)) + sensorscolumnar_old_8999011 | CREATE UNIQUE INDEX sensorscolumnar_old_pkey_8999011 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999011 USING btree (measureid, eventdatetime, measure_data) + sensorscolumnar_old_8999111 | CREATE INDEX sensorscolumnar_old_lower_idx_8999111 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999111 USING btree (lower((measureid)::text)) + sensorscolumnar_old_8999111 | CREATE UNIQUE INDEX sensorscolumnar_old_pkey_8999111 ON citus_split_test_schema_columnar_partitioned.sensorscolumnar_old_8999111 USING btree (measureid, eventdatetime, measure_data) +(43 rows) SELECT stxname FROM pg_statistic_ext WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; - stxname + stxname --------------------------------------------------------------------- s1 s1_8999001 s1_8999101 + s1_c + s1_c_8999009 + s1_c_8999109 s2 s2_8999005 s2_8999105 -(6 rows) + s2_c + s2_c_8999013 + s2_c_8999113 +(12 rows) -- END: Show the updated state on workers --BEGIN : Cleanup \c - postgres - :master_port - DROP SCHEMA "citus_split_test_schema_partitioned" CASCADE; -NOTICE: drop cascades to 4 other objects -DETAIL: drop cascades to table citus_split_test_schema_partitioned.sensors -drop cascades to table citus_split_test_schema_partitioned.colocated_dist_table -drop cascades to table citus_split_test_schema_partitioned.colocated_partitioned_table -drop cascades to table citus_split_test_schema_partitioned.reference_table + DROP SCHEMA "citus_split_test_schema_columnar_partitioned" CASCADE; +NOTICE: drop cascades to 5 other objects +DETAIL: drop cascades to table citus_split_test_schema_columnar_partitioned.sensors +drop cascades to table citus_split_test_schema_columnar_partitioned.sensorscolumnar +drop cascades to table citus_split_test_schema_columnar_partitioned.colocated_dist_table +drop cascades to table citus_split_test_schema_columnar_partitioned.colocated_partitioned_table +drop cascades to table citus_split_test_schema_columnar_partitioned.reference_table --END : Cleanup diff --git a/src/test/regress/expected/citus_non_blocking_split_shard_cleanup.out b/src/test/regress/expected/citus_non_blocking_split_shard_cleanup.out index 1481d786f..afa3c89e4 100644 --- a/src/test/regress/expected/citus_non_blocking_split_shard_cleanup.out +++ b/src/test/regress/expected/citus_non_blocking_split_shard_cleanup.out @@ -6,10 +6,6 @@ created for logical replication are cleaned up: 2) At destination node: Subscriptions, dummy shards. */ CREATE SCHEMA "citus_split_test_schema"; -CREATE ROLE test_split_role WITH LOGIN; -ERROR: role "test_split_role" already exists -GRANT USAGE, CREATE ON SCHEMA "citus_split_test_schema" TO test_split_role; -SET ROLE test_split_role; SET search_path TO "citus_split_test_schema"; SET citus.next_shard_id TO 8981000; SET citus.next_placement_id TO 8610000; @@ -33,7 +29,6 @@ SELECT create_distributed_table('sensors', 'measureid', colocate_with:='none'); INSERT INTO sensors SELECT i, '2020-01-05', '{}', 11011.10, 'A', 'I <3 Citus' FROM generate_series(0,1000)i; -- BEGIN : Move one shard before we split it. \c - postgres - :master_port -SET ROLE test_split_role; SET search_path TO "citus_split_test_schema"; SET citus.next_shard_id TO 8981007; SET citus.defer_drop_after_shard_move TO OFF; @@ -127,3 +122,8 @@ SELECT count(*) FROM pg_subscription; 0 (1 row) +--BEGIN : Cleanup + \c - postgres - :master_port + DROP SCHEMA "citus_split_test_schema" CASCADE; +NOTICE: drop cascades to table citus_split_test_schema.sensors +--END : Cleanup diff --git a/src/test/regress/split_schedule b/src/test/regress/split_schedule index db0237937..eaa8eb799 100644 --- a/src/test/regress/split_schedule +++ b/src/test/regress/split_schedule @@ -21,5 +21,5 @@ test: citus_split_shard_by_split_points_failure # use citus_split_shard_columnar_partitioned instead. test: citus_split_shard_columnar_partitioned test: citus_non_blocking_split_shards -test: citus_non_blocking_split_shard_partitioned test: citus_non_blocking_split_shard_cleanup +test: citus_non_blocking_split_columnar diff --git a/src/test/regress/sql/citus_non_blocking_split_shard_partitioned.sql b/src/test/regress/sql/citus_non_blocking_split_columnar.sql similarity index 79% rename from src/test/regress/sql/citus_non_blocking_split_shard_partitioned.sql rename to src/test/regress/sql/citus_non_blocking_split_columnar.sql index 4160ddd77..7d65997a3 100644 --- a/src/test/regress/sql/citus_non_blocking_split_shard_partitioned.sql +++ b/src/test/regress/sql/citus_non_blocking_split_columnar.sql @@ -1,5 +1,5 @@ -CREATE SCHEMA "citus_split_test_schema_partitioned"; -SET search_path TO "citus_split_test_schema_partitioned"; +CREATE SCHEMA "citus_split_test_schema_columnar_partitioned"; +SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.next_shard_id TO 8970000; SET citus.next_placement_id TO 8770000; SET citus.shard_count TO 1; @@ -13,24 +13,46 @@ SET citus.shard_replication_factor TO 1; PRIMARY KEY (measureid, eventdatetime, measure_data)) PARTITION BY RANGE(eventdatetime); + -- Table access method is specified on child tables + CREATE TABLE sensorscolumnar( + measureid integer, + eventdatetime date, + measure_data jsonb, + PRIMARY KEY (measureid, eventdatetime, measure_data)) + PARTITION BY RANGE(eventdatetime); + -- Create Partitions of table 'sensors'. CREATE TABLE sensors_old PARTITION OF sensors FOR VALUES FROM ('2000-01-01') TO ('2020-01-01'); CREATE TABLE sensors_2020_01_01 PARTITION OF sensors FOR VALUES FROM ('2020-01-01') TO ('2020-02-01'); CREATE TABLE sensors_news PARTITION OF sensors FOR VALUES FROM ('2020-05-01') TO ('2025-01-01'); + CREATE TABLE sensorscolumnar_old PARTITION OF sensorscolumnar FOR VALUES FROM ('2000-01-01') TO ('2020-01-01') USING COLUMNAR; + CREATE TABLE sensorscolumnar_2020_01_01 PARTITION OF sensorscolumnar FOR VALUES FROM ('2020-01-01') TO ('2020-02-01') USING COLUMNAR; + CREATE TABLE sensorscolumnar_news PARTITION OF sensorscolumnar FOR VALUES FROM ('2020-05-01') TO ('2025-01-01') USING COLUMNAR; + -- Create index on parent and child partitions. CREATE INDEX index_on_parent ON sensors(lower(measureid::text)); CREATE INDEX index_on_child ON sensors_2020_01_01(lower(measure_data::text)); + CREATE INDEX index_on_parent_columnar ON sensorscolumnar(lower(measureid::text)); + CREATE INDEX index_on_child_columnar ON sensorscolumnar_2020_01_01(lower(measure_data::text)); + ALTER INDEX index_on_parent ALTER COLUMN 1 SET STATISTICS 1000; ALTER INDEX index_on_child ALTER COLUMN 1 SET STATISTICS 1000; + ALTER INDEX index_on_parent_columnar ALTER COLUMN 1 SET STATISTICS 1000; + ALTER INDEX index_on_child_columnar ALTER COLUMN 1 SET STATISTICS 1000; + -- Create statistics on parent and child partitions. CREATE STATISTICS s1 (dependencies) ON measureid, eventdatetime FROM sensors; CREATE STATISTICS s2 (dependencies) ON measureid, eventdatetime FROM sensors_2020_01_01; + CREATE STATISTICS s1_c (dependencies) ON measureid, eventdatetime FROM sensorscolumnar; + CREATE STATISTICS s2_c (dependencies) ON measureid, eventdatetime FROM sensorscolumnar_2020_01_01; + CLUSTER sensors_2020_01_01 USING index_on_child; SELECT create_distributed_table('sensors', 'measureid'); + SELECT create_distributed_table('sensorscolumnar', 'measureid'); -- create colocated distributed tables CREATE TABLE colocated_dist_table (measureid integer PRIMARY KEY); @@ -56,8 +78,8 @@ SET citus.shard_replication_factor TO 1; INNER JOIN pg_dist_node node ON placement.groupid = node.groupid INNER JOIN pg_catalog.pg_class cls ON shard.logicalrelid = cls.oid INNER JOIN pg_catalog.pg_namespace ns ON cls.relnamespace = ns.oid - WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_partitioned' - ORDER BY logicalrelid, shardminvalue::BIGINT; + WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_columnar_partitioned' + ORDER BY logicalrelid, shardminvalue::BIGINT, nodeport; -- END: Create table to split, along with other co-located tables. Add indexes, statistics etc. -- BEGIN: Create constraints for tables. @@ -93,11 +115,12 @@ SET citus.shard_replication_factor TO 1; INSERT INTO colocated_dist_table SELECT i FROM generate_series(0,1000)i; INSERT INTO colocated_partitioned_table SELECT i, '2020-01-05' FROM generate_series(0,1000)i; INSERT INTO sensors SELECT i, '2020-01-05', '{}' FROM generate_series(0,1000)i; + INSERT INTO sensorscolumnar SELECT i, '2020-01-05', '{}' FROM generate_series(0,1000)i; -- END: Load data into tables -- BEGIN: Show the current state on workers \c - - - :worker_1_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -109,12 +132,12 @@ SET citus.shard_replication_factor TO 1; WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; \c - - - :worker_2_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -126,14 +149,14 @@ SET citus.shard_replication_factor TO 1; WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; -- END: Show the current state on workers -- BEGIN: Split a shard along its co-located shards \c - - - :master_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.next_shard_id TO 8999000; SELECT nodeid AS worker_1_node FROM pg_dist_node WHERE nodeport=:worker_1_port \gset SELECT nodeid AS worker_2_node FROM pg_dist_node WHERE nodeport=:worker_2_port \gset @@ -152,18 +175,19 @@ SET citus.shard_replication_factor TO 1; INNER JOIN pg_dist_node node ON placement.groupid = node.groupid INNER JOIN pg_catalog.pg_class cls ON shard.logicalrelid = cls.oid INNER JOIN pg_catalog.pg_namespace ns ON cls.relnamespace = ns.oid - WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_partitioned' - ORDER BY logicalrelid, shardminvalue::BIGINT; + WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_columnar_partitioned' + ORDER BY logicalrelid, shardminvalue::BIGINT, nodeport; SELECT count(*) FROM reference_table; SELECT count(*) FROM colocated_partitioned_table; SELECT count(*) FROM colocated_dist_table; SELECT count(*) FROM sensors; + SELECT count(*) FROM sensorscolumnar; -- END: Validate Shard Info and Data -- BEGIN: Show the updated state on workers \c - - - :worker_1_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -175,12 +199,12 @@ SET citus.shard_replication_factor TO 1; WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; \c - - - :worker_2_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -192,14 +216,14 @@ SET citus.shard_replication_factor TO 1; WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; -- END: Show the updated state on workers -- BEGIN: Split a partition table directly \c - - - :master_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.next_shard_id TO 8999100; SELECT nodeid AS worker_1_node FROM pg_dist_node WHERE nodeport=:worker_1_port \gset SELECT nodeid AS worker_2_node FROM pg_dist_node WHERE nodeport=:worker_2_port \gset @@ -208,7 +232,7 @@ SET citus.shard_replication_factor TO 1; 8999002, -- sensors_old ARRAY['-2127770000'], ARRAY[:worker_1_node, :worker_2_node], - 'force_logical'); + 'auto'); -- END: Split a partition table directly -- BEGIN: Validate Shard Info and Data @@ -218,18 +242,19 @@ SET citus.shard_replication_factor TO 1; INNER JOIN pg_dist_node node ON placement.groupid = node.groupid INNER JOIN pg_catalog.pg_class cls ON shard.logicalrelid = cls.oid INNER JOIN pg_catalog.pg_namespace ns ON cls.relnamespace = ns.oid - WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_partitioned' - ORDER BY logicalrelid, shardminvalue::BIGINT; + WHERE node.noderole = 'primary' AND ns.nspname = 'citus_split_test_schema_columnar_partitioned' + ORDER BY logicalrelid, shardminvalue::BIGINT, nodeport; SELECT count(*) FROM reference_table; SELECT count(*) FROM colocated_partitioned_table; SELECT count(*) FROM colocated_dist_table; SELECT count(*) FROM sensors; + SELECT count(*) FROM sensorscolumnar; -- END: Validate Shard Info and Data -- BEGIN: Show the updated state on workers \c - - - :worker_1_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -241,12 +266,12 @@ SET citus.shard_replication_factor TO 1; WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; \c - - - :worker_2_port - SET search_path TO "citus_split_test_schema_partitioned"; + SET search_path TO "citus_split_test_schema_columnar_partitioned"; SET citus.show_shards_for_app_name_prefixes = '*'; SELECT tbl.relname, fk."Constraint", fk."Definition" FROM pg_catalog.pg_class tbl @@ -258,12 +283,12 @@ SET citus.shard_replication_factor TO 1; WHERE stxnamespace IN ( SELECT oid FROM pg_namespace - WHERE nspname IN ('citus_split_test_schema_partitioned') + WHERE nspname IN ('citus_split_test_schema_columnar_partitioned') ) ORDER BY stxname ASC; -- END: Show the updated state on workers --BEGIN : Cleanup \c - postgres - :master_port - DROP SCHEMA "citus_split_test_schema_partitioned" CASCADE; + DROP SCHEMA "citus_split_test_schema_columnar_partitioned" CASCADE; --END : Cleanup diff --git a/src/test/regress/sql/citus_non_blocking_split_shard_cleanup.sql b/src/test/regress/sql/citus_non_blocking_split_shard_cleanup.sql index a87028233..334c07b1a 100644 --- a/src/test/regress/sql/citus_non_blocking_split_shard_cleanup.sql +++ b/src/test/regress/sql/citus_non_blocking_split_shard_cleanup.sql @@ -8,10 +8,6 @@ created for logical replication are cleaned up: CREATE SCHEMA "citus_split_test_schema"; -CREATE ROLE test_split_role WITH LOGIN; -GRANT USAGE, CREATE ON SCHEMA "citus_split_test_schema" TO test_split_role; -SET ROLE test_split_role; - SET search_path TO "citus_split_test_schema"; SET citus.next_shard_id TO 8981000; SET citus.next_placement_id TO 8610000; @@ -34,7 +30,6 @@ INSERT INTO sensors SELECT i, '2020-01-05', '{}', 11011.10, 'A', 'I <3 Citus' FR -- BEGIN : Move one shard before we split it. \c - postgres - :master_port -SET ROLE test_split_role; SET search_path TO "citus_split_test_schema"; SET citus.next_shard_id TO 8981007; SET citus.defer_drop_after_shard_move TO OFF; @@ -91,3 +86,8 @@ SELECT slot_name FROM pg_replication_slots; SELECT count(*) FROM pg_publication; -- All subscriptions should be cleaned up. SELECT count(*) FROM pg_subscription; + +--BEGIN : Cleanup + \c - postgres - :master_port + DROP SCHEMA "citus_split_test_schema" CASCADE; +--END : Cleanup