| From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
|---|---|
| To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Andrei Lepikhov <lepihov(at)gmail(dot)com>, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, arne(dot)roland(at)malkut(dot)net, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> |
| Subject: | Re: apply_scanjoin_target_to_paths and partitionwise join |
| Date: | 2025-10-31 12:20:53 |
| Message-ID: | CAMbWs4_VyvRMh+0bZP5cmLk3y-HmmQjqopVq14f4z4mBwpjJnQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Oct 30, 2025 at 3:29 AM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> That said, after some investigation, I believe your conclusion to be
> correct. What seems to be happening with Q3 is that the higher-cost
> path (27.47, one partitionwise join) is added before the absolute
> cheapest path (27.27, two partitionwise joins) and that's not enough
> difference for compare_path_costs_fuzzily with STD_FUZZ_FACTOR to
> prefer the second one over the first. If I raise STD_FUZZ_FACTOR from
> 0.5 to 5, to make the costs of the two paths more different, then this
> behavior vanishes. So I agree that this seems to have nothing to do
> with your work; it appears that your test cases just got swept up in
> it incidentally.
>
> Do you have any thoughts on how we might adjust these test cases?
For Q1, the plan change does not appear to compromise its original
purpose. The test case is meant to verify that unique-ification works
correctly with partitionwise joins, so as long as the join to t3 is
performed in a partitionwise manner, we're fine.
For Q2, I suspect that the cost estimation issue in mergejoin may be
affecting the planner's choice of plan. When I set enable_mergejoin
to off, I was able to get a partitionwise join plan again. Therefore,
I think we can modify the test case to manually disable mergejoin for
this query.
For Q3, you can get a plan with full partitionwise joins again by
removing either the clause "t1.c = 0" or "t1.b = 0", and doing so
doesn't change the query's output. You can also get a fully
partitionwise join plan by removing both clauses, though in that case
the query output becomes too large to include in a test case.
- Richard
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2025-10-31 12:51:34 | Re: pg_plan_advice |
| Previous Message | Álvaro Herrera | 2025-10-31 12:19:50 | Re: Consistently use the XLogRecPtrIsInvalid() macro |