Re: apply_scanjoin_target_to_paths and partitionwise join
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Andrei Lepikhov <lepihov@gmail.com>,
Jakub Wartak <jakub.wartak@enterprisedb.com>, arne.roland@malkut.net, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Julien Rouhaud <rjuju123@gmail.com>, Etsuro Fujita <etsuro.fujita@gmail.com>
Date: 2025-12-04T18:17:58Z
Lists: pgsql-hackers
On Wed, Dec 3, 2025 at 9:53 PM Richard Guo <guofenglinux@gmail.com> wrote: > Fair point. I had envisioned a separate planning step involving a new > RelOptInfo, where we would re-add paths from the scan/join RelOptInfo > after applying the target, explicitly skipping Append paths for > partitioned tables. But I admit that I am unsure if this addresses > any real problems, so the effort might not be justified. I agree that > maybe we should just go ahead with your current patch and see what > happens. I believe that I tried this at the time, and found that the cost was uncomfortably large for very simple queries. I don't remember whether I tried creating a separate RelOptInfo or something slightly simpler, like a new list of paths without a full RelOptInfo. > I suspect the same. IMHO, apply_scanjoin_target_to_paths is quite > brute-force and modifies planner structures in ways we generally > should avoid (no offense intended to the original author of this > function). I agree that the correct long-term solution is to generate > the expected target from the start, which would eliminate the need for > apply_scanjoin_target_to_paths entirely. Agreed. -- Robert Haas EDB: http://www.enterprisedb.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Remove redundant SET enable_partitionwise_join = on.
- 3f33b63de278 19 (unreleased) landed
-
Don't reset the pathlist of partitioned joinrels.
- 014f9a831a32 19 (unreleased) landed
-
Allow left join removals and unique joins on partitioned tables
- 3c569049b7b5 16.0 cited
-
Consider fractional paths in generate_orderedappend_paths
- 6b94e7a6da2f 15.0 cited
-
Fix handling of targetlist SRFs when scan/join relation is known empty.
- 1d338584062b 12.0 cited