Skip to content

Commit 7516056

Browse files
committed
Attempt to stabilize new window agg regression test
This test was recently added in 3900a02. It appears to be unstable in regards to the join order presumably due to the relations at either side of the join being equal in side. Here we add a qual to make one of them smaller so the planner is more likely to choose to hash the smaller of the two. Reported-by: Nathan Bossart, Tom Lane Discussion: https://www.postgr.es/m/20230803235403.GC1238296@nathanxps13
1 parent 3fd19a9 commit 7516056

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/test/regress/expected/window.out

+6-4
Original file line numberDiff line numberDiff line change
@@ -4834,17 +4834,19 @@ LIMIT 1;
48344834
EXPLAIN (COSTS OFF)
48354835
SELECT COUNT(*) OVER ()
48364836
FROM tenk1 t1 INNER JOIN tenk1 t2 ON t1.unique1 = t2.tenthous
4837+
WHERE t2.two = 1
48374838
LIMIT 1;
4838-
QUERY PLAN
4839-
--------------------------------------------------------------------------------
4839+
QUERY PLAN
4840+
-------------------------------------------------------------------
48404841
Limit
48414842
-> WindowAgg
48424843
-> Hash Join
48434844
Hash Cond: (t1.unique1 = t2.tenthous)
48444845
-> Index Only Scan using tenk1_unique1 on tenk1 t1
48454846
-> Hash
4846-
-> Index Only Scan using tenk1_thous_tenthous on tenk1 t2
4847-
(7 rows)
4847+
-> Seq Scan on tenk1 t2
4848+
Filter: (two = 1)
4849+
(8 rows)
48484850

48494851
-- Ensure we get a cheap total plan. This time use UNBOUNDED FOLLOWING, which
48504852
-- needs to read all join rows to output the first WindowAgg row.

src/test/regress/sql/window.sql

+1
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,7 @@ LIMIT 1;
17341734
EXPLAIN (COSTS OFF)
17351735
SELECT COUNT(*) OVER ()
17361736
FROM tenk1 t1 INNER JOIN tenk1 t2 ON t1.unique1 = t2.tenthous
1737+
WHERE t2.two = 1
17371738
LIMIT 1;
17381739

17391740
-- Ensure we get a cheap total plan. This time use UNBOUNDED FOLLOWING, which

0 commit comments

Comments
 (0)