Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1fe6668

Browse files
committed
Attempt to stabilize flapping regression test
Per buildfarm animal mylodon, the plan for this test was sometimesswapping the join order for tenk1 and tenk2. Given that add_path() hasno code that would cause this fluctuation when given paths with consistentcosts, this indicates that the costs must be fluctuating in some runs.The only proven reason I've seen where that could happen was slightvariations in pg_class.relpages for some tables. This was demonstrated tobe true byf03a9ca and related discussion. Manually adjusting tenk2'spg_class.relpages by subtracting just 1 page does cause the plan to changefor this test.Here we've not gone to the same lengths to prove that's what's going onin this case. Proving that does not seem worth the time. Let's justshrink one side of the join so the additional cost of the swapped joinorder is sufficiently different that if the relpages estimate is off a fewpages that the planner still shouldn't swap the join order.Reported-by: Thomas MunroAuthor: Andy Fan, David RowleyDiscussion:https://postgr.es/m/CA+hUKGLqC-NobKYfjxNM3Gexv9OJ-Fhvy9bugUcXsZjTqH7W=Q@mail.gmail.com
1 parentbf82f43 commit1fe6668

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

‎src/test/regress/expected/union.out

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ where (x = 0) or (q1 >= q2 and q1 <= q2);
14381438
-- Ensure we get a Nested Loop join between tenk1 and tenk2
14391439
explain (costs off)
14401440
select t1.unique1 from tenk1 t1
1441-
inner join tenk2 t2 on t1.tenthous = t2.tenthous
1441+
inner join tenk2 t2 on t1.tenthous = t2.tenthous and t2.thousand = 0
14421442
union all
14431443
(values(1)) limit 1;
14441444
QUERY PLAN
@@ -1450,8 +1450,9 @@ inner join tenk2 t2 on t1.tenthous = t2.tenthous
14501450
-> Seq Scan on tenk1 t1
14511451
-> Materialize
14521452
-> Seq Scan on tenk2 t2
1453+
Filter: (thousand = 0)
14531454
-> Result
1454-
(8 rows)
1455+
(9 rows)
14551456

14561457
-- Ensure there is no problem if cheapest_startup_path is NULL
14571458
explain (costs off)

‎src/test/regress/sql/union.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ where (x = 0) or (q1 >= q2 and q1 <= q2);
548548
-- Ensure we get a Nested Loop join between tenk1 and tenk2
549549
explain (costs off)
550550
selectt1.unique1from tenk1 t1
551-
inner join tenk2 t2ont1.tenthous=t2.tenthous
551+
inner join tenk2 t2ont1.tenthous=t2.tenthousandt2.thousand=0
552552
union all
553553
(values(1))limit1;
554554

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp