pull/7643/head
paragjain 2024-07-13 07:24:44 +00:00
parent 98ac3aa938
commit 9243b5992b
3 changed files with 66 additions and 60 deletions

View File

@ -81,19 +81,19 @@ SELECT * FROM target;
(2 rows) (2 rows)
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
QUERY PLAN QUERY PLAN
--------------------------------------------------------------------- ---------------------------------------------------------------------
Custom Scan (Citus MERGE INTO ...) (cost=0.00..0.00 rows=0 width=0) Custom Scan (Citus MERGE INTO ...)
MERGE INTO target method: pull to coordinator MERGE INTO target method: pull to coordinator
-> Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0) -> Custom Scan (Citus Adaptive)
Task Count: 1 Task Count: 1
Tasks Shown: All Tasks Shown: All
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000000 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000000 source
(8 rows) (8 rows)
DROP TABLE IF EXISTS source; DROP TABLE IF EXISTS source;
@ -151,19 +151,19 @@ SELECT * FROM target;
(2 rows) (2 rows)
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
QUERY PLAN QUERY PLAN
--------------------------------------------------------------------- ---------------------------------------------------------------------
Custom Scan (Citus MERGE INTO ...) (cost=0.00..0.00 rows=0 width=0) Custom Scan (Citus MERGE INTO ...)
MERGE INTO target method: pull to coordinator MERGE INTO target method: pull to coordinator
-> Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0) -> Custom Scan (Citus Adaptive)
Task Count: 1 Task Count: 1
Tasks Shown: All Tasks Shown: All
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000002 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000002 source
(8 rows) (8 rows)
DROP TABLE IF EXISTS source; DROP TABLE IF EXISTS source;
@ -221,28 +221,28 @@ SELECT * FROM target;
(2 rows) (2 rows)
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
QUERY PLAN QUERY PLAN
--------------------------------------------------------------------- ---------------------------------------------------------------------
Custom Scan (Citus MERGE INTO ...) (cost=0.00..0.00 rows=0 width=0) Custom Scan (Citus MERGE INTO ...)
MERGE INTO target method: pull to coordinator MERGE INTO target method: pull to coordinator
-> Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=100000 width=40) -> Custom Scan (Citus Adaptive)
Task Count: 4 Task Count: 4
Tasks Shown: All Tasks Shown: All
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000007 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000007 source
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000008 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000008 source
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000009 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000009 source
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000010 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000010 source
(17 rows) (17 rows)
DROP TABLE IF EXISTS source; DROP TABLE IF EXISTS source;
@ -300,28 +300,28 @@ SELECT * FROM target;
(2 rows) (2 rows)
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
QUERY PLAN QUERY PLAN
--------------------------------------------------------------------- ---------------------------------------------------------------------
Custom Scan (Citus MERGE INTO ...) (cost=0.00..0.00 rows=0 width=0) Custom Scan (Citus MERGE INTO ...)
MERGE INTO target method: repartition MERGE INTO target method: repartition
-> Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=100000 width=40) -> Custom Scan (Citus Adaptive)
Task Count: 4 Task Count: 4
Tasks Shown: All Tasks Shown: All
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000012 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000012 source
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000013 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000013 source
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000014 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000014 source
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000015 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000015 source
(17 rows) (17 rows)
DROP TABLE IF EXISTS source; DROP TABLE IF EXISTS source;
@ -379,28 +379,28 @@ SELECT * FROM target;
(2 rows) (2 rows)
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
QUERY PLAN QUERY PLAN
--------------------------------------------------------------------- ---------------------------------------------------------------------
Custom Scan (Citus MERGE INTO ...) (cost=0.00..0.00 rows=0 width=0) Custom Scan (Citus MERGE INTO ...)
MERGE INTO target method: repartition MERGE INTO target method: repartition
-> Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=100000 width=40) -> Custom Scan (Citus Adaptive)
Task Count: 4 Task Count: 4
Tasks Shown: All Tasks Shown: All
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000020 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000020 source
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000021 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000021 source
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000022 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000022 source
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Seq Scan on source_4000023 source (cost=0.00..22.00 rows=1200 width=40) -> Seq Scan on source_4000023 source
(17 rows) (17 rows)
DROP TABLE IF EXISTS source; DROP TABLE IF EXISTS source;
@ -458,21 +458,21 @@ SELECT * FROM target;
(2 rows) (2 rows)
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
QUERY PLAN QUERY PLAN
--------------------------------------------------------------------- ---------------------------------------------------------------------
Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0) Custom Scan (Citus Adaptive)
Task Count: 1 Task Count: 1
Tasks Shown: All Tasks Shown: All
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Merge on target_4000029 target (cost=0.00..137.01 rows=0 width=0) -> Merge on target_4000029 target
-> Nested Loop (cost=0.00..137.01 rows=7200 width=6) -> Nested Loop
-> Seq Scan on source_4000028 source (cost=0.00..22.00 rows=1200 width=0) -> Seq Scan on source_4000028 source
-> Materialize (cost=0.00..25.03 rows=6 width=6) -> Materialize
-> Seq Scan on target_4000029 target (cost=0.00..25.00 rows=6 width=6) -> Seq Scan on target_4000029 target
Filter: ('2'::bigint = id) Filter: ('2'::bigint = id)
(11 rows) (11 rows)

View File

@ -0,0 +1,6 @@
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int >= 15 AS server_version_ge_15
\gset
\if :server_version_ge_15
\else
\q

View File

@ -65,7 +65,7 @@ VALUES (src.t_id, doc);
SELECT * FROM target; SELECT * FROM target;
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
@ -113,7 +113,7 @@ VALUES (src.t_id, doc);
SELECT * FROM target; SELECT * FROM target;
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
@ -162,7 +162,7 @@ VALUES (src.t_id, doc);
SELECT * FROM target; SELECT * FROM target;
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
@ -209,7 +209,7 @@ VALUES (src.t_id, doc);
SELECT * FROM target; SELECT * FROM target;
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
@ -257,7 +257,7 @@ VALUES (src.t_id, doc);
SELECT * FROM target; SELECT * FROM target;
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;
@ -305,7 +305,7 @@ VALUES (src.t_id, doc);
SELECT * FROM target; SELECT * FROM target;
-- Explain -- Explain
EXPLAIN MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src EXPLAIN (costs off, timing off, summary off) MERGE INTO ONLY target USING (SELECT 2::bigint AS t_id, doc FROM source) src
ON (src.t_id = target.id) ON (src.t_id = target.id)
WHEN MATCHED THEN DO NOTHING; WHEN MATCHED THEN DO NOTHING;