Merge branch 'main' into eag/mvtest1

pull/8334/head
eaydingol 2025-11-14 09:31:06 +03:00 committed by GitHub
commit 6d65a1f8f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 163 additions and 108 deletions

View File

@ -376,9 +376,12 @@ s/\<is referenced from table\>/is still referenced from table/g
# ignore any "find_in_path:" lines in test output
/DEBUG: find_in_path: trying .*/d
# PG18: EXPLAIN ANALYZE prints "Index Searches: N" for index scans — remove it
/^\s*Index Searches:\s*\d+\s*$/d
# EXPLAIN (PG18+): hide Materialize storage instrumentation
# this rule can be removed when PG18 is the minimum supported version
/^[ \t]*Storage:[ \t].*$/d
# PG18: drop 'subscription "<name>"' prefix
# this rule can be removed when PG18 is the minimum supported version
s/^[[:space:]]*ERROR:[[:space:]]+subscription "[^"]+" could not connect to the publisher:[[:space:]]*/ERROR: could not connect to the publisher: /I
# PG18: drop verbose 'connection to server … failed:' preamble
s/^[[:space:]]*ERROR:[[:space:]]+could not connect to the publisher:[[:space:]]*connection to server .* failed:[[:space:]]*/ERROR: could not connect to the publisher: /I

View File

@ -979,6 +979,7 @@ DETAIL: unparameterized; 1 clauses pushed down
(1 row)
SET hash_mem_multiplier = 1.0;
\pset footer off
SELECT columnar_test_helpers.explain_with_pg16_subplan_format($Q$
EXPLAIN (analyze on, costs off, timing off, summary off, BUFFERS OFF)
SELECT sum(a) FROM pushdown_test where
@ -1017,8 +1018,8 @@ CONTEXT: PL/pgSQL function columnar_test_helpers.explain_with_pg16_subplan_form
-> Materialize (actual rows=100 loops=199)
-> Custom Scan (ColumnarScan) on pushdown_test pushdown_test_1 (actual rows=199 loops=1)
Columnar Projected Columns: a
(11 rows)
\pset footer on
RESET hash_mem_multiplier;
SELECT sum(a) FROM pushdown_test where
(

View File

@ -979,6 +979,7 @@ DETAIL: unparameterized; 1 clauses pushed down
(1 row)
SET hash_mem_multiplier = 1.0;
\pset footer off
SELECT columnar_test_helpers.explain_with_pg16_subplan_format($Q$
EXPLAIN (analyze on, costs off, timing off, summary off, BUFFERS OFF)
SELECT sum(a) FROM pushdown_test where
@ -1017,8 +1018,8 @@ CONTEXT: PL/pgSQL function columnar_test_helpers.explain_with_pg16_subplan_form
-> Materialize (actual rows=100 loops=199)
-> Custom Scan (ColumnarScan) on pushdown_test pushdown_test_1 (actual rows=199 loops=1)
Columnar Projected Columns: a
(11 rows)
\pset footer on
RESET hash_mem_multiplier;
SELECT sum(a) FROM pushdown_test where
(

View File

@ -204,6 +204,9 @@ $$
t
(1 row)
BEGIN;
SET LOCAL enable_indexscan TO 'OFF';
SET LOCAL enable_bitmapscan TO 'OFF';
SELECT columnar_test_helpers.uses_custom_scan (
$$
SELECT a FROM full_correlated WHERE a=0 OR a=5;
@ -214,8 +217,11 @@ $$
t
(1 row)
ROLLBACK;
BEGIN;
SET LOCAL columnar.enable_custom_scan TO 'OFF';
SET LOCAL enable_indexscan TO 'OFF';
SET LOCAL enable_bitmapscan TO 'OFF';
SELECT columnar_test_helpers.uses_seq_scan (
$$
SELECT a FROM full_correlated WHERE a=0 OR a=5;
@ -598,11 +604,11 @@ SELECT * FROM correlated WHERE x = 78910;
(1 row)
-- should choose index scan; selective but uncorrelated
EXPLAIN (analyze on, costs off, timing off, summary off, BUFFERS OFF)
EXPLAIN (analyze off, costs off, timing off, summary off, BUFFERS OFF)
SELECT * FROM uncorrelated WHERE x = 78910;
QUERY PLAN
---------------------------------------------------------------------
Index Scan using uncorrelated_idx on uncorrelated (actual rows=1 loops=1)
Index Scan using uncorrelated_idx on uncorrelated
Index Cond: (x = 78910)
(2 rows)

View File

@ -204,6 +204,9 @@ $$
t
(1 row)
BEGIN;
SET LOCAL enable_indexscan TO 'OFF';
SET LOCAL enable_bitmapscan TO 'OFF';
SELECT columnar_test_helpers.uses_custom_scan (
$$
SELECT a FROM full_correlated WHERE a=0 OR a=5;
@ -214,8 +217,11 @@ $$
t
(1 row)
ROLLBACK;
BEGIN;
SET LOCAL columnar.enable_custom_scan TO 'OFF';
SET LOCAL enable_indexscan TO 'OFF';
SET LOCAL enable_bitmapscan TO 'OFF';
SELECT columnar_test_helpers.uses_seq_scan (
$$
SELECT a FROM full_correlated WHERE a=0 OR a=5;
@ -602,11 +608,11 @@ SELECT * FROM correlated WHERE x = 78910;
(1 row)
-- should choose index scan; selective but uncorrelated
EXPLAIN (analyze on, costs off, timing off, summary off, BUFFERS OFF)
EXPLAIN (analyze off, costs off, timing off, summary off, BUFFERS OFF)
SELECT * FROM uncorrelated WHERE x = 78910;
QUERY PLAN
---------------------------------------------------------------------
Index Scan using uncorrelated_idx on uncorrelated (actual rows=1 loops=1)
Index Scan using uncorrelated_idx on uncorrelated
Index Cond: (x = 78910)
(2 rows)

View File

@ -312,21 +312,22 @@ EXPLAIN (COSTS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
Filter: (age = 20)
(8 rows)
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
QUERY PLAN
\pset footer off
select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20');
explain_filter
---------------------------------------------------------------------
Custom Scan (Citus Adaptive) (actual rows=1 loops=1)
Task Count: 1
Tuple data received from nodes: 14 bytes
Custom Scan (Citus Adaptive) (actual rows=N loops=N)
Task Count: N
Tuple data received from nodes: N bytes
Tasks Shown: All
-> Task
Tuple data received from node: 14 bytes
Node: host=localhost port=xxxxx dbname=regression
-> Index Scan using distributed_table_pkey_1470001 on distributed_table_1470001 distributed_table (actual rows=1 loops=1)
Index Cond: (key = 1)
Filter: (age = 20)
(10 rows)
Tuple data received from node: N bytes
Node: host=localhost port=N dbname=regression
-> Index Scan using distributed_table_pkey_1470001 on distributed_table_1470001 distributed_table (actual rows=N loops=N)
Index Cond: (key = N)
Filter: (age = N)
\pset footer on
EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
WITH r AS ( SELECT GREATEST(random(), 2) z,* FROM distributed_table)
SELECT 1 FROM r WHERE z < 3;
@ -368,21 +369,22 @@ EXPLAIN (COSTS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
Filter: (age = 20)
(9 rows)
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
QUERY PLAN
\pset footer off
select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20');
explain_filter
---------------------------------------------------------------------
Custom Scan (Citus Adaptive) (actual rows=0 loops=1)
Task Count: 1
Custom Scan (Citus Adaptive) (actual rows=N loops=N)
Task Count: N
Tasks Shown: All
-> Task
Node: host=localhost port=xxxxx dbname=regression
-> Delete on distributed_table_1470001 distributed_table (actual rows=0 loops=1)
-> Index Scan using distributed_table_pkey_1470001 on distributed_table_1470001 distributed_table (actual rows=1 loops=1)
Index Cond: (key = 1)
Filter: (age = 20)
Trigger for constraint second_distributed_table_key_fkey_1470005: calls=1
(10 rows)
Node: host=localhost port=N dbname=regression
-> Delete on distributed_table_1470001 distributed_table (actual rows=N loops=N)
-> Index Scan using distributed_table_pkey_1470001 on distributed_table_1470001 distributed_table (actual rows=N loops=N)
Index Cond: (key = N)
Filter: (age = N)
Trigger for constraint second_distributed_table_key_fkey_1470005: calls=N
\pset footer on
-- show that EXPLAIN ANALYZE deleted the row and cascades deletes
SELECT * FROM distributed_table WHERE key = 1 AND age = 20 ORDER BY 1,2,3;
NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((key OPERATOR(pg_catalog.=) 1) AND (age OPERATOR(pg_catalog.=) 20)) ORDER BY key, value, age

View File

@ -250,21 +250,22 @@ EXPLAIN (COSTS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
Filter: (age = 20)
(8 rows)
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
QUERY PLAN
\pset footer off
select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20');
explain_filter
---------------------------------------------------------------------
Custom Scan (Citus Adaptive) (actual rows=1 loops=1)
Task Count: 1
Tuple data received from nodes: 14 bytes
Custom Scan (Citus Adaptive) (actual rows=N loops=N)
Task Count: N
Tuple data received from nodes: N bytes
Tasks Shown: All
-> Task
Tuple data received from node: 14 bytes
Node: host=localhost port=xxxxx dbname=regression
-> Index Scan using distributed_table_pkey_1500001 on distributed_table_1500001 distributed_table (actual rows=1 loops=1)
Index Cond: (key = 1)
Filter: (age = 20)
(10 rows)
Tuple data received from node: N bytes
Node: host=localhost port=N dbname=regression
-> Index Scan using distributed_table_pkey_1500001 on distributed_table_1500001 distributed_table (actual rows=N loops=N)
Index Cond: (key = N)
Filter: (age = N)
\pset footer on
EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
WITH r AS ( SELECT GREATEST(random(), 2) z,* FROM distributed_table)
SELECT 1 FROM r WHERE z < 3;
@ -306,20 +307,21 @@ EXPLAIN (COSTS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
Filter: (age = 20)
(9 rows)
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
QUERY PLAN
\pset footer off
select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20');
explain_filter
---------------------------------------------------------------------
Custom Scan (Citus Adaptive) (actual rows=0 loops=1)
Task Count: 1
Custom Scan (Citus Adaptive) (actual rows=N loops=N)
Task Count: N
Tasks Shown: All
-> Task
Node: host=localhost port=xxxxx dbname=regression
-> Delete on distributed_table_1500001 distributed_table (actual rows=0 loops=1)
-> Index Scan using distributed_table_pkey_1500001 on distributed_table_1500001 distributed_table (actual rows=1 loops=1)
Index Cond: (key = 1)
Filter: (age = 20)
(9 rows)
Node: host=localhost port=N dbname=regression
-> Delete on distributed_table_1500001 distributed_table (actual rows=N loops=N)
-> Index Scan using distributed_table_pkey_1500001 on distributed_table_1500001 distributed_table (actual rows=N loops=N)
Index Cond: (key = N)
Filter: (age = N)
\pset footer on
-- show that EXPLAIN ANALYZE deleted the row
SELECT * FROM distributed_table WHERE key = 1 AND age = 20 ORDER BY 1,2,3;
NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution_replicated.distributed_table_1500001 distributed_table WHERE ((key OPERATOR(pg_catalog.=) 1) AND (age OPERATOR(pg_catalog.=) 20)) ORDER BY key, value, age

View File

@ -519,20 +519,22 @@ Custom Scan (Citus Adaptive)
Filter: (l_partkey = 0)
-- Test analyze (with TIMING FALSE and SUMMARY FALSE for consistent output)
BEGIN;
select public.explain_filter('
EXPLAIN (COSTS FALSE, ANALYZE TRUE, TIMING FALSE, SUMMARY FALSE, BUFFERS OFF)
UPDATE lineitem
SET l_suppkey = 12
WHERE l_orderkey = 1 AND l_partkey = 0;
Custom Scan (Citus Adaptive) (actual rows=0 loops=1)
Task Count: 1
WHERE l_orderkey = 1 AND l_partkey = 0
');
Custom Scan (Citus Adaptive) (actual rows=N loops=N)
Task Count: N
Tasks Shown: All
-> Task
Node: host=localhost port=xxxxx dbname=regression
-> Update on lineitem_360000 lineitem (actual rows=0 loops=1)
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (actual rows=0 loops=1)
Index Cond: (l_orderkey = 1)
Filter: (l_partkey = 0)
Rows Removed by Filter: 6
Node: host=localhost port=N dbname=regression
-> Update on lineitem_360000 lineitem (actual rows=N loops=N)
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (actual rows=N loops=N)
Index Cond: (l_orderkey = N)
Filter: (l_partkey = N)
Rows Removed by Filter: N
ROLLBACk;
-- Test delete
EXPLAIN (COSTS FALSE)
@ -1387,16 +1389,16 @@ Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0)
Node: host=localhost port=xxxxx dbname=regression
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (cost=0.28..13.60 rows=4 width=5)
Index Cond: (l_orderkey = 5)
EXPLAIN (ANALYZE ON, COSTS OFF, TIMING OFF, SUMMARY OFF, BUFFERS OFF) EXECUTE router_executor_query_param(5);
Custom Scan (Citus Adaptive) (actual rows=3 loops=1)
Task Count: 1
Tuple data received from nodes: 30 bytes
select public.explain_filter('EXPLAIN (ANALYZE ON, COSTS OFF, TIMING OFF, SUMMARY OFF, BUFFERS OFF) EXECUTE router_executor_query_param(5)');
Custom Scan (Citus Adaptive) (actual rows=N loops=N)
Task Count: N
Tuple data received from nodes: N bytes
Tasks Shown: All
-> Task
Tuple data received from node: 30 bytes
Node: host=localhost port=xxxxx dbname=regression
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (actual rows=3 loops=1)
Index Cond: (l_orderkey = 5)
Tuple data received from node: N bytes
Node: host=localhost port=N dbname=regression
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (actual rows=N loops=N)
Index Cond: (l_orderkey = N)
\set VERBOSITY TERSE
PREPARE multi_shard_query_param(int) AS UPDATE lineitem SET l_quantity = $1;
BEGIN;

View File

@ -519,20 +519,22 @@ Custom Scan (Citus Adaptive)
Filter: (l_partkey = 0)
-- Test analyze (with TIMING FALSE and SUMMARY FALSE for consistent output)
BEGIN;
select public.explain_filter('
EXPLAIN (COSTS FALSE, ANALYZE TRUE, TIMING FALSE, SUMMARY FALSE, BUFFERS OFF)
UPDATE lineitem
SET l_suppkey = 12
WHERE l_orderkey = 1 AND l_partkey = 0;
Custom Scan (Citus Adaptive) (actual rows=0 loops=1)
Task Count: 1
WHERE l_orderkey = 1 AND l_partkey = 0
');
Custom Scan (Citus Adaptive) (actual rows=N loops=N)
Task Count: N
Tasks Shown: All
-> Task
Node: host=localhost port=xxxxx dbname=regression
-> Update on lineitem_360000 lineitem (actual rows=0 loops=1)
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (actual rows=0 loops=1)
Index Cond: (l_orderkey = 1)
Filter: (l_partkey = 0)
Rows Removed by Filter: 6
Node: host=localhost port=N dbname=regression
-> Update on lineitem_360000 lineitem (actual rows=N loops=N)
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (actual rows=N loops=N)
Index Cond: (l_orderkey = N)
Filter: (l_partkey = N)
Rows Removed by Filter: N
ROLLBACk;
-- Test delete
EXPLAIN (COSTS FALSE)
@ -1387,16 +1389,16 @@ Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0)
Node: host=localhost port=xxxxx dbname=regression
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (cost=0.28..13.60 rows=4 width=5)
Index Cond: (l_orderkey = 5)
EXPLAIN (ANALYZE ON, COSTS OFF, TIMING OFF, SUMMARY OFF, BUFFERS OFF) EXECUTE router_executor_query_param(5);
Custom Scan (Citus Adaptive) (actual rows=3 loops=1)
Task Count: 1
Tuple data received from nodes: 30 bytes
select public.explain_filter('EXPLAIN (ANALYZE ON, COSTS OFF, TIMING OFF, SUMMARY OFF, BUFFERS OFF) EXECUTE router_executor_query_param(5)');
Custom Scan (Citus Adaptive) (actual rows=N loops=N)
Task Count: N
Tuple data received from nodes: N bytes
Tasks Shown: All
-> Task
Tuple data received from node: 30 bytes
Node: host=localhost port=xxxxx dbname=regression
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (actual rows=3 loops=1)
Index Cond: (l_orderkey = 5)
Tuple data received from node: N bytes
Node: host=localhost port=N dbname=regression
-> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (actual rows=N loops=N)
Index Cond: (l_orderkey = N)
\set VERBOSITY TERSE
PREPARE multi_shard_query_param(int) AS UPDATE lineitem SET l_quantity = $1;
BEGIN;

View File

@ -732,6 +732,11 @@ declare
begin
for ln in execute $1
loop
-- PG18 extra line "Index Searches: N" — remove entirely
IF ln ~ '^[[:space:]]*Index[[:space:]]+Searches:[[:space:]]*[0-9]+[[:space:]]*$' THEN
CONTINUE;
END IF;
-- Replace any numeric word with just 'N'
ln := regexp_replace(ln, '-?\m\d+\M', 'N', 'g');
-- In sort output, the above won't match units-suffixed numbers

View File

@ -419,6 +419,7 @@ SELECT sum(a) FROM pushdown_test where (a > random() and a <= 2000) or (a > 2000
SELECT sum(a) FROM pushdown_test where (a > random() and a <= 2000) or (a > 200000-1010);
SET hash_mem_multiplier = 1.0;
\pset footer off
SELECT columnar_test_helpers.explain_with_pg16_subplan_format($Q$
EXPLAIN (analyze on, costs off, timing off, summary off, BUFFERS OFF)
SELECT sum(a) FROM pushdown_test where
@ -433,6 +434,7 @@ SELECT sum(a) FROM pushdown_test where
or
(a > 200000-2010);
$Q$) as "QUERY PLAN";
\pset footer on
RESET hash_mem_multiplier;
SELECT sum(a) FROM pushdown_test where
(

View File

@ -141,14 +141,21 @@ SELECT a FROM full_correlated WHERE a>200;
$$
);
BEGIN;
SET LOCAL enable_indexscan TO 'OFF';
SET LOCAL enable_bitmapscan TO 'OFF';
SELECT columnar_test_helpers.uses_custom_scan (
$$
SELECT a FROM full_correlated WHERE a=0 OR a=5;
$$
);
ROLLBACK;
BEGIN;
SET LOCAL columnar.enable_custom_scan TO 'OFF';
SET LOCAL enable_indexscan TO 'OFF';
SET LOCAL enable_bitmapscan TO 'OFF';
SELECT columnar_test_helpers.uses_seq_scan (
$$
SELECT a FROM full_correlated WHERE a=0 OR a=5;
@ -366,7 +373,7 @@ SELECT * FROM correlated WHERE x = 78910;
SELECT * FROM correlated WHERE x = 78910;
-- should choose index scan; selective but uncorrelated
EXPLAIN (analyze on, costs off, timing off, summary off, BUFFERS OFF)
EXPLAIN (analyze off, costs off, timing off, summary off, BUFFERS OFF)
SELECT * FROM uncorrelated WHERE x = 78910;
SELECT * FROM uncorrelated WHERE x = 78910;

View File

@ -218,7 +218,9 @@ SET citus.enable_binary_protocol = TRUE;
-- though going through distributed execution
EXPLAIN (COSTS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
\pset footer off
select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20');
\pset footer on
EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
WITH r AS ( SELECT GREATEST(random(), 2) z,* FROM distributed_table)
@ -226,7 +228,10 @@ SELECT 1 FROM r WHERE z < 3;
EXPLAIN (COSTS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
\pset footer off
select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20');
\pset footer on
-- show that EXPLAIN ANALYZE deleted the row and cascades deletes
SELECT * FROM distributed_table WHERE key = 1 AND age = 20 ORDER BY 1,2,3;
SELECT * FROM second_distributed_table WHERE key = 1 ORDER BY 1,2;

View File

@ -183,7 +183,9 @@ SET citus.enable_binary_protocol = TRUE;
-- though going through distributed execution
EXPLAIN (COSTS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
\pset footer off
select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20');
\pset footer on
EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
WITH r AS ( SELECT GREATEST(random(), 2) z,* FROM distributed_table)
@ -191,7 +193,9 @@ SELECT 1 FROM r WHERE z < 3;
EXPLAIN (COSTS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
\pset footer off
select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20');
\pset footer on
-- show that EXPLAIN ANALYZE deleted the row
SELECT * FROM distributed_table WHERE key = 1 AND age = 20 ORDER BY 1,2,3;
SELECT * FROM second_distributed_table WHERE key = 1 ORDER BY 1,2;

View File

@ -184,10 +184,12 @@ EXPLAIN (COSTS FALSE)
-- Test analyze (with TIMING FALSE and SUMMARY FALSE for consistent output)
BEGIN;
select public.explain_filter('
EXPLAIN (COSTS FALSE, ANALYZE TRUE, TIMING FALSE, SUMMARY FALSE, BUFFERS OFF)
UPDATE lineitem
SET l_suppkey = 12
WHERE l_orderkey = 1 AND l_partkey = 0;
WHERE l_orderkey = 1 AND l_partkey = 0
');
ROLLBACk;
-- Test delete
@ -597,7 +599,7 @@ EXPLAIN (COSTS FALSE) EXECUTE real_time_executor_query;
-- at least make sure to fail without crashing
PREPARE router_executor_query_param(int) AS SELECT l_quantity FROM lineitem WHERE l_orderkey = $1;
EXPLAIN EXECUTE router_executor_query_param(5);
EXPLAIN (ANALYZE ON, COSTS OFF, TIMING OFF, SUMMARY OFF, BUFFERS OFF) EXECUTE router_executor_query_param(5);
select public.explain_filter('EXPLAIN (ANALYZE ON, COSTS OFF, TIMING OFF, SUMMARY OFF, BUFFERS OFF) EXECUTE router_executor_query_param(5)');
\set VERBOSITY TERSE
PREPARE multi_shard_query_param(int) AS UPDATE lineitem SET l_quantity = $1;

View File

@ -763,6 +763,11 @@ declare
begin
for ln in execute $1
loop
-- PG18 extra line "Index Searches: N" — remove entirely
IF ln ~ '^[[:space:]]*Index[[:space:]]+Searches:[[:space:]]*[0-9]+[[:space:]]*$' THEN
CONTINUE;
END IF;
-- Replace any numeric word with just 'N'
ln := regexp_replace(ln, '-?\m\d+\M', 'N', 'g');
-- In sort output, the above won't match units-suffixed numbers