mirror of https://github.com/citusdata/citus.git
Flaky test: Force correct plan (#3203)
Failing test: https://app.circleci.com/jobs/github/citusdata/citus/23148pull/3205/head^2
parent
26c306d188
commit
1ac96f228b
|
@ -62,11 +62,11 @@ SELECT * FROM partitioning_hash_test ORDER BY 1;
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
-- see partitioned table and its partitions are distributed
|
-- see partitioned table and its partitions are distributed
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid
|
logicalrelid
|
||||||
FROM
|
FROM
|
||||||
pg_dist_partition
|
pg_dist_partition
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_test', 'partitioning_test_2009', 'partitioning_test_2010')
|
logicalrelid IN ('partitioning_test', 'partitioning_test_2009', 'partitioning_test_2010')
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -76,9 +76,9 @@ ORDER BY 1;
|
||||||
partitioning_test_2010
|
partitioning_test_2010
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid, count(*)
|
logicalrelid, count(*)
|
||||||
FROM pg_dist_shard
|
FROM pg_dist_shard
|
||||||
WHERE logicalrelid IN ('partitioning_test', 'partitioning_test_2009', 'partitioning_test_2010')
|
WHERE logicalrelid IN ('partitioning_test', 'partitioning_test_2009', 'partitioning_test_2010')
|
||||||
GROUP BY
|
GROUP BY
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -91,11 +91,11 @@ ORDER BY
|
||||||
partitioning_test_2010 | 4
|
partitioning_test_2010 | 4
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid
|
logicalrelid
|
||||||
FROM
|
FROM
|
||||||
pg_dist_partition
|
pg_dist_partition
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_hash_test', 'partitioning_hash_test_0', 'partitioning_hash_test_1')
|
logicalrelid IN ('partitioning_hash_test', 'partitioning_hash_test_0', 'partitioning_hash_test_1')
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -105,9 +105,9 @@ ORDER BY 1;
|
||||||
partitioning_hash_test_1
|
partitioning_hash_test_1
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid, count(*)
|
logicalrelid, count(*)
|
||||||
FROM pg_dist_shard
|
FROM pg_dist_shard
|
||||||
WHERE logicalrelid IN ('partitioning_hash_test', 'partitioning_hash_test_0', 'partitioning_hash_test_1')
|
WHERE logicalrelid IN ('partitioning_hash_test', 'partitioning_hash_test_0', 'partitioning_hash_test_1')
|
||||||
GROUP BY
|
GROUP BY
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -123,11 +123,11 @@ ORDER BY
|
||||||
-- 2-) Creating partition of a distributed table
|
-- 2-) Creating partition of a distributed table
|
||||||
CREATE TABLE partitioning_test_2011 PARTITION OF partitioning_test FOR VALUES FROM ('2011-01-01') TO ('2012-01-01');
|
CREATE TABLE partitioning_test_2011 PARTITION OF partitioning_test FOR VALUES FROM ('2011-01-01') TO ('2012-01-01');
|
||||||
-- new partition is automatically distributed as well
|
-- new partition is automatically distributed as well
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid
|
logicalrelid
|
||||||
FROM
|
FROM
|
||||||
pg_dist_partition
|
pg_dist_partition
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_test', 'partitioning_test_2011')
|
logicalrelid IN ('partitioning_test', 'partitioning_test_2011')
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -136,9 +136,9 @@ ORDER BY 1;
|
||||||
partitioning_test_2011
|
partitioning_test_2011
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid, count(*)
|
logicalrelid, count(*)
|
||||||
FROM pg_dist_shard
|
FROM pg_dist_shard
|
||||||
WHERE logicalrelid IN ('partitioning_test', 'partitioning_test_2011')
|
WHERE logicalrelid IN ('partitioning_test', 'partitioning_test_2011')
|
||||||
GROUP BY
|
GROUP BY
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -158,11 +158,11 @@ INSERT INTO partitioning_test_2012 VALUES (6, '2012-07-07');
|
||||||
ALTER TABLE partitioning_test ATTACH PARTITION partitioning_test_2012 FOR VALUES FROM ('2012-01-01') TO ('2013-01-01');
|
ALTER TABLE partitioning_test ATTACH PARTITION partitioning_test_2012 FOR VALUES FROM ('2012-01-01') TO ('2013-01-01');
|
||||||
NOTICE: Copying data from local table...
|
NOTICE: Copying data from local table...
|
||||||
-- attached partition is distributed as well
|
-- attached partition is distributed as well
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid
|
logicalrelid
|
||||||
FROM
|
FROM
|
||||||
pg_dist_partition
|
pg_dist_partition
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_test', 'partitioning_test_2012')
|
logicalrelid IN ('partitioning_test', 'partitioning_test_2012')
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -171,9 +171,9 @@ ORDER BY 1;
|
||||||
partitioning_test_2012
|
partitioning_test_2012
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid, count(*)
|
logicalrelid, count(*)
|
||||||
FROM pg_dist_shard
|
FROM pg_dist_shard
|
||||||
WHERE logicalrelid IN ('partitioning_test', 'partitioning_test_2012')
|
WHERE logicalrelid IN ('partitioning_test', 'partitioning_test_2012')
|
||||||
GROUP BY
|
GROUP BY
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -614,7 +614,7 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
information_schema.table_constraints
|
information_schema.table_constraints
|
||||||
WHERE
|
WHERE
|
||||||
table_name = 'partitioning_test_2009' AND
|
table_name = 'partitioning_test_2009' AND
|
||||||
constraint_name = 'partitioning_2009_primary';
|
constraint_name = 'partitioning_2009_primary';
|
||||||
table_name | constraint_name | constraint_type
|
table_name | constraint_name | constraint_type
|
||||||
------------------------+---------------------------+-----------------
|
------------------------+---------------------------+-----------------
|
||||||
|
@ -732,9 +732,9 @@ SELECT right(table_name, 7)::int as shardid, * FROM (
|
||||||
json_array_elements_text(result::json)::json )).*
|
json_array_elements_text(result::json)::json )).*
|
||||||
FROM run_command_on_workers($$
|
FROM run_command_on_workers($$
|
||||||
SELECT
|
SELECT
|
||||||
COALESCE(json_agg(row_to_json(q)), '[]'::json)
|
COALESCE(json_agg(row_to_json(q)), '[]'::json)
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
table_name, constraint_name, constraint_type
|
table_name, constraint_name, constraint_type
|
||||||
FROM information_schema.table_constraints
|
FROM information_schema.table_constraints
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -994,40 +994,40 @@ SELECT ("final_query"."event_types") as types, count(*) AS sumOfEventType
|
||||||
FROM
|
FROM
|
||||||
(SELECT *, random()
|
(SELECT *, random()
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"t"."user_id", "t"."time", unnest("t"."collected_events") AS "event_types"
|
"t"."user_id", "t"."time", unnest("t"."collected_events") AS "event_types"
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"t1"."user_id", min("t1"."time") AS "time", array_agg(("t1"."event") ORDER BY TIME ASC, event DESC) AS collected_events
|
"t1"."user_id", min("t1"."time") AS "time", array_agg(("t1"."event") ORDER BY TIME ASC, event DESC) AS collected_events
|
||||||
FROM(
|
FROM(
|
||||||
(SELECT
|
(SELECT
|
||||||
"events"."user_id", "events"."time", 0 AS event
|
"events"."user_id", "events"."time", 0 AS event
|
||||||
FROM
|
FROM
|
||||||
partitioned_events_table as "events"
|
partitioned_events_table as "events"
|
||||||
WHERE
|
WHERE
|
||||||
event_type IN (1, 2) )
|
event_type IN (1, 2) )
|
||||||
UNION
|
UNION
|
||||||
(SELECT
|
(SELECT
|
||||||
"events"."user_id", "events"."time", 1 AS event
|
"events"."user_id", "events"."time", 1 AS event
|
||||||
FROM
|
FROM
|
||||||
partitioned_events_table as "events"
|
partitioned_events_table as "events"
|
||||||
WHERE
|
WHERE
|
||||||
event_type IN (3, 4) )
|
event_type IN (3, 4) )
|
||||||
UNION
|
UNION
|
||||||
(SELECT
|
(SELECT
|
||||||
"events"."user_id", "events"."time", 2 AS event
|
"events"."user_id", "events"."time", 2 AS event
|
||||||
FROM
|
FROM
|
||||||
partitioned_events_table as "events"
|
partitioned_events_table as "events"
|
||||||
WHERE
|
WHERE
|
||||||
event_type IN (5, 6) )
|
event_type IN (5, 6) )
|
||||||
UNION
|
UNION
|
||||||
(SELECT
|
(SELECT
|
||||||
"events"."user_id", "events"."time", 3 AS event
|
"events"."user_id", "events"."time", 3 AS event
|
||||||
FROM
|
FROM
|
||||||
partitioned_events_table as "events"
|
partitioned_events_table as "events"
|
||||||
WHERE
|
WHERE
|
||||||
event_type IN (1, 6))) t1
|
event_type IN (1, 6))) t1
|
||||||
GROUP BY "t1"."user_id") AS t) "q"
|
GROUP BY "t1"."user_id") AS t) "q"
|
||||||
) AS final_query
|
) AS final_query
|
||||||
GROUP BY types
|
GROUP BY types
|
||||||
ORDER BY types;
|
ORDER BY types;
|
||||||
|
@ -1042,73 +1042,73 @@ ORDER BY types;
|
||||||
-- UNION and JOIN on both partitioned and regular tables
|
-- UNION and JOIN on both partitioned and regular tables
|
||||||
SELECT ("final_query"."event_types") as types, count(*) AS sumOfEventType
|
SELECT ("final_query"."event_types") as types, count(*) AS sumOfEventType
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
*, random()
|
*, random()
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"t"."user_id", "t"."time", unnest("t"."collected_events") AS "event_types"
|
"t"."user_id", "t"."time", unnest("t"."collected_events") AS "event_types"
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"t1"."user_id", min("t1"."time") AS "time", array_agg(("t1"."event") ORDER BY TIME ASC, event DESC) AS collected_events
|
"t1"."user_id", min("t1"."time") AS "time", array_agg(("t1"."event") ORDER BY TIME ASC, event DESC) AS collected_events
|
||||||
FROM (
|
FROM (
|
||||||
(SELECT
|
(SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"events"."time", 0 AS event, "events"."user_id"
|
"events"."time", 0 AS event, "events"."user_id"
|
||||||
FROM
|
FROM
|
||||||
partitioned_events_table as "events"
|
partitioned_events_table as "events"
|
||||||
WHERE
|
WHERE
|
||||||
event_type IN (1, 2)) events_subquery_1)
|
event_type IN (1, 2)) events_subquery_1)
|
||||||
UNION
|
UNION
|
||||||
(SELECT *
|
(SELECT *
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT * FROM
|
SELECT * FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
max("events"."time"),
|
max("events"."time"),
|
||||||
0 AS event,
|
0 AS event,
|
||||||
"events"."user_id"
|
"events"."user_id"
|
||||||
FROM
|
FROM
|
||||||
events_table as "events", users_table as "users"
|
events_table as "events", users_table as "users"
|
||||||
WHERE
|
WHERE
|
||||||
events.user_id = users.user_id AND
|
events.user_id = users.user_id AND
|
||||||
event_type IN (1, 2)
|
event_type IN (1, 2)
|
||||||
GROUP BY "events"."user_id"
|
GROUP BY "events"."user_id"
|
||||||
) as events_subquery_5
|
) as events_subquery_5
|
||||||
) events_subquery_2)
|
) events_subquery_2)
|
||||||
UNION
|
UNION
|
||||||
(SELECT *
|
(SELECT *
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"events"."time", 2 AS event, "events"."user_id"
|
"events"."time", 2 AS event, "events"."user_id"
|
||||||
FROM
|
FROM
|
||||||
partitioned_events_table as "events"
|
partitioned_events_table as "events"
|
||||||
WHERE
|
WHERE
|
||||||
event_type IN (3, 4)) events_subquery_3)
|
event_type IN (3, 4)) events_subquery_3)
|
||||||
UNION
|
UNION
|
||||||
(SELECT *
|
(SELECT *
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"events"."time", 3 AS event, "events"."user_id"
|
"events"."time", 3 AS event, "events"."user_id"
|
||||||
FROM
|
FROM
|
||||||
events_table as "events"
|
events_table as "events"
|
||||||
WHERE
|
WHERE
|
||||||
event_type IN (5, 6)) events_subquery_4)
|
event_type IN (5, 6)) events_subquery_4)
|
||||||
) t1
|
) t1
|
||||||
GROUP BY "t1"."user_id") AS t) "q"
|
GROUP BY "t1"."user_id") AS t) "q"
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
(SELECT
|
(SELECT
|
||||||
"users"."user_id"
|
"users"."user_id"
|
||||||
FROM
|
FROM
|
||||||
partitioned_users_table as "users"
|
partitioned_users_table as "users"
|
||||||
WHERE
|
WHERE
|
||||||
value_1 > 2 and value_1 < 5) AS t
|
value_1 > 2 and value_1 < 5) AS t
|
||||||
ON (t.user_id = q.user_id)) as final_query
|
ON (t.user_id = q.user_id)) as final_query
|
||||||
GROUP BY
|
GROUP BY
|
||||||
types
|
types
|
||||||
ORDER BY
|
ORDER BY
|
||||||
types;
|
types;
|
||||||
types | sumofeventtype
|
types | sumofeventtype
|
||||||
-------+----------------
|
-------+----------------
|
||||||
|
@ -1148,37 +1148,37 @@ WHERE
|
||||||
SELECT
|
SELECT
|
||||||
count(*) AS cnt, "generated_group_field"
|
count(*) AS cnt, "generated_group_field"
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"eventQuery"."user_id", random(), generated_group_field
|
"eventQuery"."user_id", random(), generated_group_field
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"multi_group_wrapper_1".*, generated_group_field, random()
|
"multi_group_wrapper_1".*, generated_group_field, random()
|
||||||
FROM
|
FROM
|
||||||
(SELECT *
|
(SELECT *
|
||||||
FROM
|
FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
"list_partitioned_events_table"."time", "list_partitioned_events_table"."user_id" as event_user_id
|
"list_partitioned_events_table"."time", "list_partitioned_events_table"."user_id" as event_user_id
|
||||||
FROM
|
FROM
|
||||||
list_partitioned_events_table as "list_partitioned_events_table"
|
list_partitioned_events_table as "list_partitioned_events_table"
|
||||||
WHERE
|
WHERE
|
||||||
user_id > 2) "temp_data_queries"
|
user_id > 2) "temp_data_queries"
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
(SELECT
|
(SELECT
|
||||||
"users"."user_id"
|
"users"."user_id"
|
||||||
FROM
|
FROM
|
||||||
partitioned_users_table as "users"
|
partitioned_users_table as "users"
|
||||||
WHERE
|
WHERE
|
||||||
user_id > 2 and value_2 = 1) "user_filters_1"
|
user_id > 2 and value_2 = 1) "user_filters_1"
|
||||||
ON ("temp_data_queries".event_user_id = "user_filters_1".user_id)) AS "multi_group_wrapper_1"
|
ON ("temp_data_queries".event_user_id = "user_filters_1".user_id)) AS "multi_group_wrapper_1"
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
(SELECT
|
(SELECT
|
||||||
"users"."user_id" AS "user_id", value_2 AS "generated_group_field"
|
"users"."user_id" AS "user_id", value_2 AS "generated_group_field"
|
||||||
FROM
|
FROM
|
||||||
partitioned_users_table as "users") "left_group_by_1"
|
partitioned_users_table as "users") "left_group_by_1"
|
||||||
ON ("left_group_by_1".user_id = "multi_group_wrapper_1".event_user_id)) "eventQuery") "pushedDownQuery"
|
ON ("left_group_by_1".user_id = "multi_group_wrapper_1".event_user_id)) "eventQuery") "pushedDownQuery"
|
||||||
GROUP BY
|
GROUP BY
|
||||||
"generated_group_field"
|
"generated_group_field"
|
||||||
ORDER BY
|
ORDER BY
|
||||||
cnt DESC, generated_group_field ASC
|
cnt DESC, generated_group_field ASC
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
cnt | generated_group_field
|
cnt | generated_group_field
|
||||||
|
@ -1595,7 +1595,14 @@ SELECT * FROM partitioning_hash_test JOIN partitioning_hash_join_test USING (id,
|
||||||
-> Parallel Seq Scan on partitioning_hash_test_2_1660032 partitioning_hash_test_2
|
-> Parallel Seq Scan on partitioning_hash_test_2_1660032 partitioning_hash_test_2
|
||||||
(18 rows)
|
(18 rows)
|
||||||
|
|
||||||
-- set partition-wise join on
|
-- set partition-wise join on and parallel to off
|
||||||
|
SELECT success FROM run_command_on_workers('alter system set max_parallel_workers_per_gather = 0');
|
||||||
|
success
|
||||||
|
---------
|
||||||
|
t
|
||||||
|
t
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
SELECT success FROM run_command_on_workers('alter system set enable_partitionwise_join to on');
|
SELECT success FROM run_command_on_workers('alter system set enable_partitionwise_join to on');
|
||||||
success
|
success
|
||||||
---------
|
---------
|
||||||
|
@ -1611,6 +1618,7 @@ SELECT success FROM run_command_on_workers('select pg_reload_conf()');
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
SET enable_partitionwise_join TO on;
|
SET enable_partitionwise_join TO on;
|
||||||
|
ANALYZE partitioning_hash_test, partitioning_hash_join_test;
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT * FROM partitioning_hash_test JOIN partitioning_hash_join_test USING (id, subid);
|
SELECT * FROM partitioning_hash_test JOIN partitioning_hash_join_test USING (id, subid);
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
|
@ -1699,6 +1707,13 @@ SELECT success FROM run_command_on_workers('alter system reset enable_indexonlys
|
||||||
t
|
t
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
|
SELECT success FROM run_command_on_workers('alter system reset max_parallel_workers_per_gather');
|
||||||
|
success
|
||||||
|
---------
|
||||||
|
t
|
||||||
|
t
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
SELECT success FROM run_command_on_workers('select pg_reload_conf()');
|
SELECT success FROM run_command_on_workers('select pg_reload_conf()');
|
||||||
success
|
success
|
||||||
---------
|
---------
|
||||||
|
@ -1739,11 +1754,11 @@ SELECT create_distributed_table('partitioning_schema."schema-test"', 'id');
|
||||||
CREATE TABLE partitioning_schema."schema-test_2009"(id int, time date);
|
CREATE TABLE partitioning_schema."schema-test_2009"(id int, time date);
|
||||||
ALTER TABLE partitioning_schema."schema-test" ATTACH PARTITION partitioning_schema."schema-test_2009" FOR VALUES FROM ('2009-01-01') TO ('2010-01-01');
|
ALTER TABLE partitioning_schema."schema-test" ATTACH PARTITION partitioning_schema."schema-test_2009" FOR VALUES FROM ('2009-01-01') TO ('2010-01-01');
|
||||||
-- attached partition is distributed as well
|
-- attached partition is distributed as well
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid
|
logicalrelid
|
||||||
FROM
|
FROM
|
||||||
pg_dist_partition
|
pg_dist_partition
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -1752,10 +1767,10 @@ ORDER BY 1;
|
||||||
partitioning_schema."schema-test_2009"
|
partitioning_schema."schema-test_2009"
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid, count(*)
|
logicalrelid, count(*)
|
||||||
FROM
|
FROM
|
||||||
pg_dist_shard
|
pg_dist_shard
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
||||||
GROUP BY
|
GROUP BY
|
||||||
|
@ -1779,11 +1794,11 @@ SELECT create_distributed_table('partitioning_schema."schema-test"', 'id');
|
||||||
|
|
||||||
CREATE TABLE partitioning_schema."schema-test_2009" PARTITION OF partitioning_schema."schema-test" FOR VALUES FROM ('2009-01-01') TO ('2010-01-01');
|
CREATE TABLE partitioning_schema."schema-test_2009" PARTITION OF partitioning_schema."schema-test" FOR VALUES FROM ('2009-01-01') TO ('2010-01-01');
|
||||||
-- newly created partition is distributed as well
|
-- newly created partition is distributed as well
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid
|
logicalrelid
|
||||||
FROM
|
FROM
|
||||||
pg_dist_partition
|
pg_dist_partition
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -1792,10 +1807,10 @@ ORDER BY 1;
|
||||||
partitioning_schema."schema-test_2009"
|
partitioning_schema."schema-test_2009"
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid, count(*)
|
logicalrelid, count(*)
|
||||||
FROM
|
FROM
|
||||||
pg_dist_shard
|
pg_dist_shard
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
||||||
GROUP BY
|
GROUP BY
|
||||||
|
@ -1820,11 +1835,11 @@ SELECT create_distributed_table('"schema-test"', 'id');
|
||||||
|
|
||||||
CREATE TABLE partitioning_schema."schema-test_2009" PARTITION OF "schema-test" FOR VALUES FROM ('2009-01-01') TO ('2010-01-01');
|
CREATE TABLE partitioning_schema."schema-test_2009" PARTITION OF "schema-test" FOR VALUES FROM ('2009-01-01') TO ('2010-01-01');
|
||||||
-- newly created partition is distributed as well
|
-- newly created partition is distributed as well
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid
|
logicalrelid
|
||||||
FROM
|
FROM
|
||||||
pg_dist_partition
|
pg_dist_partition
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
logicalrelid
|
logicalrelid
|
||||||
|
@ -1833,10 +1848,10 @@ ORDER BY 1;
|
||||||
"schema-test_2009"
|
"schema-test_2009"
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid, count(*)
|
logicalrelid, count(*)
|
||||||
FROM
|
FROM
|
||||||
pg_dist_shard
|
pg_dist_shard
|
||||||
WHERE
|
WHERE
|
||||||
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
logicalrelid IN ('partitioning_schema."schema-test"'::regclass, 'partitioning_schema."schema-test_2009"'::regclass)
|
||||||
GROUP BY
|
GROUP BY
|
||||||
|
|
|
@ -998,11 +998,13 @@ SELECT success FROM run_command_on_workers('select pg_reload_conf()');
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT * FROM partitioning_hash_test JOIN partitioning_hash_join_test USING (id, subid);
|
SELECT * FROM partitioning_hash_test JOIN partitioning_hash_join_test USING (id, subid);
|
||||||
|
|
||||||
-- set partition-wise join on
|
-- set partition-wise join on and parallel to off
|
||||||
|
SELECT success FROM run_command_on_workers('alter system set max_parallel_workers_per_gather = 0');
|
||||||
SELECT success FROM run_command_on_workers('alter system set enable_partitionwise_join to on');
|
SELECT success FROM run_command_on_workers('alter system set enable_partitionwise_join to on');
|
||||||
SELECT success FROM run_command_on_workers('select pg_reload_conf()');
|
SELECT success FROM run_command_on_workers('select pg_reload_conf()');
|
||||||
|
|
||||||
SET enable_partitionwise_join TO on;
|
SET enable_partitionwise_join TO on;
|
||||||
|
ANALYZE partitioning_hash_test, partitioning_hash_join_test;
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT * FROM partitioning_hash_test JOIN partitioning_hash_join_test USING (id, subid);
|
SELECT * FROM partitioning_hash_test JOIN partitioning_hash_join_test USING (id, subid);
|
||||||
|
@ -1019,6 +1021,7 @@ SELECT success FROM run_command_on_workers('alter system reset enable_mergejoin'
|
||||||
SELECT success FROM run_command_on_workers('alter system reset enable_nestloop');
|
SELECT success FROM run_command_on_workers('alter system reset enable_nestloop');
|
||||||
SELECT success FROM run_command_on_workers('alter system reset enable_indexscan');
|
SELECT success FROM run_command_on_workers('alter system reset enable_indexscan');
|
||||||
SELECT success FROM run_command_on_workers('alter system reset enable_indexonlyscan');
|
SELECT success FROM run_command_on_workers('alter system reset enable_indexonlyscan');
|
||||||
|
SELECT success FROM run_command_on_workers('alter system reset max_parallel_workers_per_gather');
|
||||||
SELECT success FROM run_command_on_workers('select pg_reload_conf()');
|
SELECT success FROM run_command_on_workers('select pg_reload_conf()');
|
||||||
|
|
||||||
RESET enable_partitionwise_join;
|
RESET enable_partitionwise_join;
|
||||||
|
|
Loading…
Reference in New Issue