From d268aa7bc8d5ad8d4172b44cea8e9d6df21c6d84 Mon Sep 17 00:00:00 2001 From: Ahmet Gedemenli Date: Fri, 25 Sep 2020 17:06:35 +0300 Subject: [PATCH 1/4] Support EXPLAIN(ANALYZE, WAL) --- .../distributed/planner/multi_explain.c | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/backend/distributed/planner/multi_explain.c b/src/backend/distributed/planner/multi_explain.c index 5ab31a1a1..4f1ca8347 100644 --- a/src/backend/distributed/planner/multi_explain.c +++ b/src/backend/distributed/planner/multi_explain.c @@ -83,6 +83,7 @@ typedef struct bool verbose; bool costs; bool buffers; + bool wal; bool timing; bool summary; ExplainFormat format; @@ -91,7 +92,7 @@ typedef struct /* EXPLAIN flags of current distributed explain */ static ExplainOptions CurrentDistributedQueryExplainOptions = { - 0, 0, 0, 0, 0, EXPLAIN_FORMAT_TEXT + 0, 0, 0, 0, 0, 0, EXPLAIN_FORMAT_TEXT }; /* Result for a single remote EXPLAIN command */ @@ -904,12 +905,18 @@ BuildRemoteExplainQuery(char *queryString, ExplainState *es) appendStringInfo(explainQuery, "EXPLAIN (ANALYZE %s, VERBOSE %s, " - "COSTS %s, BUFFERS %s, TIMING %s, SUMMARY %s, " - "FORMAT %s) %s", + "COSTS %s, BUFFERS %s, " +#if PG_VERSION_NUM >= PG_VERSION_13 + "WAL %s, " +#endif + "TIMING %s, SUMMARY %s, FORMAT %s) %s", es->analyze ? "TRUE" : "FALSE", es->verbose ? "TRUE" : "FALSE", es->costs ? "TRUE" : "FALSE", es->buffers ? "TRUE" : "FALSE", +#if PG_VERSION_NUM >= PG_VERSION_13 + es->wal ? "TRUE" : "FALSE", +#endif es->timing ? "TRUE" : "FALSE", es->summary ? "TRUE" : "FALSE", formatStr, @@ -1005,6 +1012,9 @@ worker_save_query_explain_analyze(PG_FUNCTION_ARGS) /* use the same defaults as NewExplainState() for following options */ es->buffers = ExtractFieldBoolean(explainOptions, "buffers", es->buffers); +#if PG_VERSION_NUM >= PG_VERSION_13 + es->wal = ExtractFieldBoolean(explainOptions, "wal", es->wal); +#endif es->costs = ExtractFieldBoolean(explainOptions, "costs", es->costs); es->summary = ExtractFieldBoolean(explainOptions, "summary", es->summary); es->verbose = ExtractFieldBoolean(explainOptions, "verbose", es->verbose); @@ -1206,6 +1216,9 @@ CitusExplainOneQuery(Query *query, int cursorOptions, IntoClause *into, /* save the flags of current EXPLAIN command */ CurrentDistributedQueryExplainOptions.costs = es->costs; CurrentDistributedQueryExplainOptions.buffers = es->buffers; +#if PG_VERSION_NUM >= PG_VERSION_13 + CurrentDistributedQueryExplainOptions.wal = es->wal; +#endif CurrentDistributedQueryExplainOptions.verbose = es->verbose; CurrentDistributedQueryExplainOptions.summary = es->summary; CurrentDistributedQueryExplainOptions.timing = es->timing; @@ -1482,11 +1495,18 @@ WrapQueryForExplainAnalyze(const char *queryString, TupleDesc tupleDesc) } StringInfo explainOptions = makeStringInfo(); - appendStringInfo(explainOptions, "{\"verbose\": %s, \"costs\": %s, \"buffers\": %s, " - "\"timing\": %s, \"summary\": %s, \"format\": \"%s\"}", + appendStringInfo(explainOptions, + "{\"verbose\": %s, \"costs\": %s, \"buffers\": %s, " +#if PG_VERSION_NUM >= PG_VERSION_13 + "\"wal\": %s, " +#endif + "\"timing\": %s, \"summary\": %s, \"format\": \"%s\"}", CurrentDistributedQueryExplainOptions.verbose ? "true" : "false", CurrentDistributedQueryExplainOptions.costs ? "true" : "false", CurrentDistributedQueryExplainOptions.buffers ? "true" : "false", +#if PG_VERSION_NUM >= PG_VERSION_13 + CurrentDistributedQueryExplainOptions.wal ? "true" : "false", +#endif CurrentDistributedQueryExplainOptions.timing ? "true" : "false", CurrentDistributedQueryExplainOptions.summary ? "true" : "false", ExplainFormatStr(CurrentDistributedQueryExplainOptions.format)); @@ -1632,7 +1652,10 @@ ExplainWorkerPlan(PlannedStmt *plannedstmt, DestReceiver *dest, ExplainState *es if (es->buffers) instrument_option |= INSTRUMENT_BUFFERS; - +#if PG_VERSION_NUM >= PG_VERSION_13 + if (es->wal) + instrument_option |= INSTRUMENT_WAL; +#endif /* * We always collect timing for the entire statement, even when node-level * timing is off, so we don't look at es->timing here. (We could skip From 3357eea46b330e301342778a6f7e45c45a88f52f Mon Sep 17 00:00:00 2001 From: Ahmet Gedemenli Date: Tue, 29 Sep 2020 11:38:19 +0300 Subject: [PATCH 2/4] Add regression tests for PG13 WAL --- src/test/regress/expected/pg13.out | 68 +++++++++++++++++++++++++----- src/test/regress/sql/pg13.sql | 11 +++++ 2 files changed, 68 insertions(+), 11 deletions(-) diff --git a/src/test/regress/expected/pg13.out b/src/test/regress/expected/pg13.out index 938604788..4908360f8 100644 --- a/src/test/regress/expected/pg13.out +++ b/src/test/regress/expected/pg13.out @@ -170,15 +170,61 @@ SELECT create_distributed_table('test_table', 'a'); -- we currently don't support this CREATE INDEX test_table_index ON test_table USING gist (b tsvector_ops(siglen = 100)); ERROR: citus currently doesn't support operator class parameters in indexes +-- testing WAL +CREATE TABLE test_wal(a int, b int); +-- test WAL without ANALYZE, this should raise an error +EXPLAIN (WAL) INSERT INTO test_wal VALUES(1,11); +ERROR: EXPLAIN option WAL requires ANALYZE +-- test WAL working properly +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) INSERT INTO test_wal VALUES(1,11); + QUERY PLAN +--------------------------------------------------------------------- + Insert on test_wal (actual rows=0 loops=1) + WAL: records=1 bytes=63 + -> Result (actual rows=1 loops=1) +(3 rows) + +SELECT create_distributed_table('test_wal', 'a'); +NOTICE: Copying data from local table... +NOTICE: copying the data has completed +DETAIL: The local data in the table is no longer visible, but is still on disk. +HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$test_pg13.test_wal$$) + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) INSERT INTO test_wal VALUES(2,22); + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Adaptive) (actual rows=0 loops=1) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Insert on test_wal_65013 (actual rows=0 loops=1) + WAL: records=1 bytes=63 + -> Result (actual rows=1 loops=1) +(8 rows) + +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) WITH cte_1 AS (DELETE FROM test_wal WHERE a=2 RETURNING *) SELECT * FROM cte_1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Adaptive) (actual rows=1 loops=1) + Task Count: 1 + Tuple data received from nodes: 3 bytes + Tasks Shown: All + -> Task + Tuple data received from node: 3 bytes + Node: host=localhost port=xxxxx dbname=regression + -> CTE Scan on cte_1 (actual rows=1 loops=1) + WAL: records=1 bytes=54 + CTE cte_1 + -> Delete on test_wal_65013 test_wal (actual rows=1 loops=1) + WAL: records=1 bytes=54 + -> Seq Scan on test_wal_65013 test_wal (actual rows=1 loops=1) + Filter: (a = 2) +(14 rows) + +SET client_min_messages TO WARNING; drop schema test_pg13 cascade; -NOTICE: drop cascades to 10 other objects -DETAIL: drop cascades to table dist_table -drop cascades to table generated_col_table -drop cascades to view v -drop cascades to table ab -drop cascades to table text_table -drop cascades to function myvarcharout(myvarchar) -drop cascades to type myvarchar -drop cascades to function myvarcharin(cstring,oid,integer) -drop cascades to table my_table -drop cascades to table test_table diff --git a/src/test/regress/sql/pg13.sql b/src/test/regress/sql/pg13.sql index 3c423c96e..b9197761f 100644 --- a/src/test/regress/sql/pg13.sql +++ b/src/test/regress/sql/pg13.sql @@ -94,4 +94,15 @@ SELECT create_distributed_table('test_table', 'a'); -- we currently don't support this CREATE INDEX test_table_index ON test_table USING gist (b tsvector_ops(siglen = 100)); +-- testing WAL +CREATE TABLE test_wal(a int, b int); +-- test WAL without ANALYZE, this should raise an error +EXPLAIN (WAL) INSERT INTO test_wal VALUES(1,11); +-- test WAL working properly +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) INSERT INTO test_wal VALUES(1,11); +SELECT create_distributed_table('test_wal', 'a'); +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) INSERT INTO test_wal VALUES(2,22); +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) WITH cte_1 AS (DELETE FROM test_wal WHERE a=2 RETURNING *) SELECT * FROM cte_1; +SET client_min_messages TO WARNING; + drop schema test_pg13 cascade; From 13ef8252e7b0eee89d737d4209301b5ca908d302 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Tue, 29 Sep 2020 14:25:16 +0200 Subject: [PATCH 3/4] Add broken distributed subplan test --- src/test/regress/expected/pg13.out | 72 +++++++++++++++++++++++------- src/test/regress/sql/pg13.sql | 23 +++++++--- 2 files changed, 75 insertions(+), 20 deletions(-) diff --git a/src/test/regress/expected/pg13.out b/src/test/regress/expected/pg13.out index 4908360f8..6d7a19101 100644 --- a/src/test/regress/expected/pg13.out +++ b/src/test/regress/expected/pg13.out @@ -175,8 +175,9 @@ CREATE TABLE test_wal(a int, b int); -- test WAL without ANALYZE, this should raise an error EXPLAIN (WAL) INSERT INTO test_wal VALUES(1,11); ERROR: EXPLAIN option WAL requires ANALYZE --- test WAL working properly -EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) INSERT INTO test_wal VALUES(1,11); +-- test WAL working properly for router queries +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) +INSERT INTO test_wal VALUES(1,11); QUERY PLAN --------------------------------------------------------------------- Insert on test_wal (actual rows=0 loops=1) @@ -194,7 +195,8 @@ HINT: To remove the local data, run: SELECT truncate_local_data_after_distribut (1 row) -EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) INSERT INTO test_wal VALUES(2,22); +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) +INSERT INTO test_wal VALUES(2,22); QUERY PLAN --------------------------------------------------------------------- Custom Scan (Citus Adaptive) (actual rows=0 loops=1) @@ -207,24 +209,64 @@ EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMI -> Result (actual rows=1 loops=1) (8 rows) -EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) WITH cte_1 AS (DELETE FROM test_wal WHERE a=2 RETURNING *) SELECT * FROM cte_1; - QUERY PLAN +-- Test WAL working for multi-shard query +SET citus.explain_all_tasks TO on; +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) +DELETE FROM test_wal RETURNING *; + QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) (actual rows=1 loops=1) - Task Count: 1 - Tuple data received from nodes: 3 bytes + Custom Scan (Citus Adaptive) (actual rows=2 loops=1) + Task Count: 2 + Tuple data received from nodes: 6 bytes Tasks Shown: All -> Task Tuple data received from node: 3 bytes Node: host=localhost port=xxxxx dbname=regression - -> CTE Scan on cte_1 (actual rows=1 loops=1) + -> Delete on test_wal_65012 test_wal (actual rows=1 loops=1) WAL: records=1 bytes=54 - CTE cte_1 - -> Delete on test_wal_65013 test_wal (actual rows=1 loops=1) - WAL: records=1 bytes=54 - -> Seq Scan on test_wal_65013 test_wal (actual rows=1 loops=1) - Filter: (a = 2) -(14 rows) + -> Seq Scan on test_wal_65012 test_wal (actual rows=1 loops=1) + -> Task + Tuple data received from node: 3 bytes + Node: host=localhost port=xxxxx dbname=regression + -> Delete on test_wal_65013 test_wal (actual rows=1 loops=1) + WAL: records=1 bytes=54 + -> Seq Scan on test_wal_65013 test_wal (actual rows=1 loops=1) +(16 rows) + +-- insert items back for next query +INSERT INTO test_wal VALUES(1,11), (2,22); +-- make sure WAL works in distributed subplans +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) +WITH cte_1 AS (DELETE FROM test_wal RETURNING *) +SELECT * FROM cte_1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Adaptive) (actual rows=2 loops=1) + -> Distributed Subplan XXX_1 + Intermediate Data Size: 36 bytes + Result destination: Write locally + -> Custom Scan (Citus Adaptive) (actual rows=0 loops=1) + Task Count: 2 + Tuple data received from nodes: 0 bytes + Tasks Shown: All + -> Task + Tuple data received from node: 0 bytes + Node: host=localhost port=xxxxx dbname=regression + -> Delete on test_wal_65012 test_wal (actual rows=0 loops=1) + -> Seq Scan on test_wal_65012 test_wal (actual rows=0 loops=1) + -> Task + Tuple data received from node: 0 bytes + Node: host=localhost port=xxxxx dbname=regression + -> Delete on test_wal_65013 test_wal (actual rows=0 loops=1) + -> Seq Scan on test_wal_65013 test_wal (actual rows=0 loops=1) + Task Count: 1 + Tuple data received from nodes: 6 bytes + Tasks Shown: All + -> Task + Tuple data received from node: 6 bytes + Node: host=localhost port=xxxxx dbname=regression + -> Function Scan on read_intermediate_result intermediate_result (actual rows=2 loops=1) +(25 rows) SET client_min_messages TO WARNING; drop schema test_pg13 cascade; diff --git a/src/test/regress/sql/pg13.sql b/src/test/regress/sql/pg13.sql index b9197761f..bfc7460f5 100644 --- a/src/test/regress/sql/pg13.sql +++ b/src/test/regress/sql/pg13.sql @@ -98,11 +98,24 @@ CREATE INDEX test_table_index ON test_table USING gist (b tsvector_ops(siglen = CREATE TABLE test_wal(a int, b int); -- test WAL without ANALYZE, this should raise an error EXPLAIN (WAL) INSERT INTO test_wal VALUES(1,11); --- test WAL working properly -EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) INSERT INTO test_wal VALUES(1,11); +-- test WAL working properly for router queries +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) +INSERT INTO test_wal VALUES(1,11); SELECT create_distributed_table('test_wal', 'a'); -EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) INSERT INTO test_wal VALUES(2,22); -EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) WITH cte_1 AS (DELETE FROM test_wal WHERE a=2 RETURNING *) SELECT * FROM cte_1; -SET client_min_messages TO WARNING; +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) +INSERT INTO test_wal VALUES(2,22); +-- Test WAL working for multi-shard query +SET citus.explain_all_tasks TO on; +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) +DELETE FROM test_wal RETURNING *; + +-- insert items back for next query +INSERT INTO test_wal VALUES(1,11), (2,22); +-- make sure WAL works in distributed subplans +EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) +WITH cte_1 AS (DELETE FROM test_wal RETURNING *) +SELECT * FROM cte_1; + +SET client_min_messages TO WARNING; drop schema test_pg13 cascade; From 70e9edb4f291e5556f3d255c890c7878b0678b6b Mon Sep 17 00:00:00 2001 From: Ahmet Gedemenli Date: Thu, 1 Oct 2020 13:52:29 +0300 Subject: [PATCH 4/4] Add subplan test with insert --- src/test/regress/expected/pg13.out | 60 ++++++++++++++---------------- src/test/regress/sql/pg13.sql | 6 +-- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/src/test/regress/expected/pg13.out b/src/test/regress/expected/pg13.out index 6d7a19101..3933cb45d 100644 --- a/src/test/regress/expected/pg13.out +++ b/src/test/regress/expected/pg13.out @@ -212,61 +212,55 @@ INSERT INTO test_wal VALUES(2,22); -- Test WAL working for multi-shard query SET citus.explain_all_tasks TO on; EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) -DELETE FROM test_wal RETURNING *; - QUERY PLAN +INSERT INTO test_wal VALUES(3,33),(4,44),(5,55) RETURNING *; + QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) (actual rows=2 loops=1) - Task Count: 2 - Tuple data received from nodes: 6 bytes + Custom Scan (Citus Adaptive) (actual rows=3 loops=1) + Task Count: 1 + Tuple data received from nodes: 9 bytes Tasks Shown: All -> Task - Tuple data received from node: 3 bytes + Tuple data received from node: 9 bytes Node: host=localhost port=xxxxx dbname=regression - -> Delete on test_wal_65012 test_wal (actual rows=1 loops=1) - WAL: records=1 bytes=54 - -> Seq Scan on test_wal_65012 test_wal (actual rows=1 loops=1) - -> Task - Tuple data received from node: 3 bytes - Node: host=localhost port=xxxxx dbname=regression - -> Delete on test_wal_65013 test_wal (actual rows=1 loops=1) - WAL: records=1 bytes=54 - -> Seq Scan on test_wal_65013 test_wal (actual rows=1 loops=1) -(16 rows) + -> Insert on test_wal_65012 citus_table_alias (actual rows=3 loops=1) + WAL: records=3 bytes=189 + -> Values Scan on "*VALUES*" (actual rows=3 loops=1) +(10 rows) --- insert items back for next query -INSERT INTO test_wal VALUES(1,11), (2,22); -- make sure WAL works in distributed subplans EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) -WITH cte_1 AS (DELETE FROM test_wal RETURNING *) +WITH cte_1 AS (INSERT INTO test_wal VALUES(6,66),(7,77),(8,88) RETURNING *) SELECT * FROM cte_1; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) (actual rows=2 loops=1) + Custom Scan (Citus Adaptive) (actual rows=3 loops=1) -> Distributed Subplan XXX_1 - Intermediate Data Size: 36 bytes + Intermediate Data Size: 54 bytes Result destination: Write locally - -> Custom Scan (Citus Adaptive) (actual rows=0 loops=1) + -> Custom Scan (Citus Adaptive) (actual rows=3 loops=1) Task Count: 2 - Tuple data received from nodes: 0 bytes + Tuple data received from nodes: 9 bytes Tasks Shown: All -> Task - Tuple data received from node: 0 bytes + Tuple data received from node: 6 bytes Node: host=localhost port=xxxxx dbname=regression - -> Delete on test_wal_65012 test_wal (actual rows=0 loops=1) - -> Seq Scan on test_wal_65012 test_wal (actual rows=0 loops=1) + -> Insert on test_wal_65012 citus_table_alias (actual rows=2 loops=1) + WAL: records=2 bytes=126 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) -> Task - Tuple data received from node: 0 bytes + Tuple data received from node: 3 bytes Node: host=localhost port=xxxxx dbname=regression - -> Delete on test_wal_65013 test_wal (actual rows=0 loops=1) - -> Seq Scan on test_wal_65013 test_wal (actual rows=0 loops=1) + -> Insert on test_wal_65013 citus_table_alias (actual rows=1 loops=1) + WAL: records=1 bytes=63 + -> Result (actual rows=1 loops=1) Task Count: 1 - Tuple data received from nodes: 6 bytes + Tuple data received from nodes: 9 bytes Tasks Shown: All -> Task - Tuple data received from node: 6 bytes + Tuple data received from node: 9 bytes Node: host=localhost port=xxxxx dbname=regression - -> Function Scan on read_intermediate_result intermediate_result (actual rows=2 loops=1) -(25 rows) + -> Function Scan on read_intermediate_result intermediate_result (actual rows=3 loops=1) +(27 rows) SET client_min_messages TO WARNING; drop schema test_pg13 cascade; diff --git a/src/test/regress/sql/pg13.sql b/src/test/regress/sql/pg13.sql index bfc7460f5..608292a9e 100644 --- a/src/test/regress/sql/pg13.sql +++ b/src/test/regress/sql/pg13.sql @@ -108,13 +108,11 @@ INSERT INTO test_wal VALUES(2,22); -- Test WAL working for multi-shard query SET citus.explain_all_tasks TO on; EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) -DELETE FROM test_wal RETURNING *; +INSERT INTO test_wal VALUES(3,33),(4,44),(5,55) RETURNING *; --- insert items back for next query -INSERT INTO test_wal VALUES(1,11), (2,22); -- make sure WAL works in distributed subplans EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE) -WITH cte_1 AS (DELETE FROM test_wal RETURNING *) +WITH cte_1 AS (INSERT INTO test_wal VALUES(6,66),(7,77),(8,88) RETURNING *) SELECT * FROM cte_1; SET client_min_messages TO WARNING;