Re: Disabling options lowers the estimated cost of a query
Tomas Vondra <tomas.vondra@enterprisedb.com>
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Arne Roland <A.Roland@index.de>,
"pgsql-performance@postgresql.org" <pgsql-performance@postgresql.org>
Date: 2021-04-16T17:59:04Z
Lists: pgsql-performance
Attachments
- merge-fraction-cheapest.patch (text/x-patch) patch
Hi, On 4/16/21 3:09 PM, Tom Lane wrote: > I wrote: >> ... The code to select the >> right child path would be approximately like get_cheapest_fractional_path, >> except that you need to restrict it to paths with the right sort order. > > Duh, I forgot about get_cheapest_fractional_path_for_pathkeys(). > > regards, tom lane > The attached patch does fix the issue for me, producing the same plans with and without partition-wise joins. It probably needs a bit more work, though: 1) If get_cheapest_fractional_path_for_pathkeys returns NULL, it's not clear whether to use cheapest_startup or cheapest_total with Sort on top. Or maybe consider an incremental sort? 2) Same for the cheapest_total - maybe there's a partially sorted path, and using it with incremental sort on top would be better than using cheapest_total_path + sort. 3) Not sure if get_cheapest_fractional_path_for_pathkeys should worry about require_parallel_safe too. Doesn't seem like an urgent issue (has been there for a while, not sure we even want to backpatch it). I'll add this to the next CF. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Consider fractional paths in generate_orderedappend_paths
- 6b94e7a6da2f 15.0 landed