Skip to content

Commit 54087f7

Browse files
Dongxiao Songmy-ship-it
authored andcommitted
Fix unstable scan rows caused by limit squelch.
Squelch in limit node may cause scan finish early, row count in scan may vary. Signed-off-by: Dongxiao Song <songdongxiao@hashdata.cn>
1 parent a279036 commit 54087f7

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/test/regress/expected/gp_explain.out

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,10 @@ DROP USER regress_range_parted_user;
577577
-- Test if explain analyze will hang with materialize node
578578
CREATE TABLE recursive_table_ic (a INT) DISTRIBUTED BY (a);
579579
INSERT INTO recursive_table_ic SELECT * FROM generate_series(20, 30000);
580+
-- start_matchsubs
581+
-- m/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/
582+
-- s/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/Seq Scan on recursive_table_ic (actual rows=#### loops=1)/
583+
-- end_matchsubs
580584
explain (analyze, costs off, timing off, summary off) WITH RECURSIVE
581585
r(i) AS (
582586
SELECT 1
@@ -600,7 +604,7 @@ SELECT * FROM y LIMIT 10;
600604
-> WorkTable Scan on y (never executed)
601605
-> Materialize (never executed)
602606
-> Gather Motion 3:1 (slice1; segments: 3) (never executed)
603-
-> Seq Scan on recursive_table_ic (actual rows=4061 loops=1)
607+
-> Seq Scan on recursive_table_ic (actual rows=#### loops=1)
604608
Optimizer: Postgres query optimizer
605609
(13 rows)
606610

src/test/regress/expected/gp_explain_optimizer.out

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,10 @@ DROP USER regress_range_parted_user;
599599
-- Test if explain analyze will hang with materialize node
600600
CREATE TABLE recursive_table_ic (a INT) DISTRIBUTED BY (a);
601601
INSERT INTO recursive_table_ic SELECT * FROM generate_series(20, 30000);
602+
-- start_matchsubs
603+
-- m/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/
604+
-- s/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/Seq Scan on recursive_table_ic (actual rows=#### loops=1)/
605+
-- end_matchsubs
602606
explain (analyze, costs off, timing off, summary off) WITH RECURSIVE
603607
r(i) AS (
604608
SELECT 1
@@ -622,7 +626,7 @@ SELECT * FROM y LIMIT 10;
622626
-> WorkTable Scan on y (never executed)
623627
-> Materialize (never executed)
624628
-> Gather Motion 3:1 (slice1; segments: 3) (never executed)
625-
-> Seq Scan on recursive_table_ic (actual rows=4061 loops=1)
629+
-> Seq Scan on recursive_table_ic (actual rows=#### loops=1)
626630
Optimizer: Postgres query optimizer
627631
(13 rows)
628632

src/test/regress/sql/gp_explain.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ DROP USER regress_range_parted_user;
285285
-- Test if explain analyze will hang with materialize node
286286
CREATE TABLE recursive_table_ic (a INT) DISTRIBUTED BY (a);
287287
INSERT INTO recursive_table_ic SELECT * FROM generate_series(20, 30000);
288-
288+
-- start_matchsubs
289+
-- m/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/
290+
-- s/Seq Scan on recursive_table_ic \(actual rows=\d+ loops=1\)/Seq Scan on recursive_table_ic (actual rows=#### loops=1)/
291+
-- end_matchsubs
289292
explain (analyze, costs off, timing off, summary off) WITH RECURSIVE
290293
r(i) AS (
291294
SELECT 1

0 commit comments

Comments
 (0)