Update normalization rules for PG18 and adjust EXPLAIN ANALYZE syntax in tests

m3hm3t/pg18_local_shard_test_fix
Mehmet Yilmaz 2025-11-05 18:54:43 +00:00
parent 55659209f5
commit 2cfdf4c414
5 changed files with 26 additions and 31 deletions

View File

@ -377,7 +377,7 @@ s/\<is referenced from table\>/is still referenced from table/g
/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
#/^\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

View File

@ -312,20 +312,18 @@ 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;
EXPLAIN (ANALYZE OFF, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
QUERY PLAN
---------------------------------------------------------------------
Custom Scan (Citus Adaptive) (actual rows=1 loops=1)
Custom Scan (Citus Adaptive)
Task Count: 1
Tuple data received from nodes: 14 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 Scan using distributed_table_pkey_1470002 on distributed_table_1470002 distributed_table
Index Cond: (key = 1)
Filter: (age = 20)
(10 rows)
(8 rows)
EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
WITH r AS ( SELECT GREATEST(random(), 2) z,* FROM distributed_table)
@ -368,20 +366,19 @@ 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;
EXPLAIN (ANALYZE OFF, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
QUERY PLAN
---------------------------------------------------------------------
Custom Scan (Citus Adaptive) (actual rows=0 loops=1)
Custom Scan (Citus Adaptive)
Task Count: 1
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)
-> Delete on distributed_table_1470002 distributed_table
-> Index Scan using distributed_table_pkey_1470002 on distributed_table_1470002 distributed_table
Index Cond: (key = 1)
Filter: (age = 20)
Trigger for constraint second_distributed_table_key_fkey_1470005: calls=1
(10 rows)
(9 rows)
-- 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;

View File

@ -250,20 +250,18 @@ 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;
EXPLAIN (ANALYZE OFF, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
QUERY PLAN
---------------------------------------------------------------------
Custom Scan (Citus Adaptive) (actual rows=1 loops=1)
Custom Scan (Citus Adaptive)
Task Count: 1
Tuple data received from nodes: 14 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 Scan using distributed_table_pkey_1500001 on distributed_table_1500001 distributed_table
Index Cond: (key = 1)
Filter: (age = 20)
(10 rows)
(8 rows)
EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
WITH r AS ( SELECT GREATEST(random(), 2) z,* FROM distributed_table)
@ -306,16 +304,16 @@ 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;
EXPLAIN (ANALYZE OFF, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
QUERY PLAN
---------------------------------------------------------------------
Custom Scan (Citus Adaptive) (actual rows=0 loops=1)
Custom Scan (Citus Adaptive)
Task Count: 1
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)
-> Delete on distributed_table_1500001 distributed_table
-> Index Scan using distributed_table_pkey_1500001 on distributed_table_1500001 distributed_table
Index Cond: (key = 1)
Filter: (age = 20)
(9 rows)

View File

@ -218,7 +218,7 @@ 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;
EXPLAIN (ANALYZE OFF, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
WITH r AS ( SELECT GREATEST(random(), 2) z,* FROM distributed_table)
@ -226,7 +226,7 @@ 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;
EXPLAIN (ANALYZE OFF, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
-- 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,7 @@ 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;
EXPLAIN (ANALYZE OFF, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20;
EXPLAIN (ANALYZE ON, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF)
WITH r AS ( SELECT GREATEST(random(), 2) z,* FROM distributed_table)
@ -191,7 +191,7 @@ 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;
EXPLAIN (ANALYZE OFF, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20;
-- 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;