Re: Allow ordered partition scans in more cases

2023-06-24 Thread David Rowley
On Sat, 4 Mar 2023 at 00:56, David Rowley wrote: > What's on my mind now is if turning 1 Sort into N Sorts is a > particularly good idea from a work_mem standpoint. I see that we don't > do tuplesort_end() until executor shutdown, so that would mean that we > could end up using 1 x work_mem per

Re: Allow ordered partition scans in more cases

2023-03-03 Thread David Rowley
On Thu, 23 Feb 2023 at 02:10, Ronan Dunklau wrote: > I haven't looked too deeply into it, but it seems reasonable that the whole > sort would cost cheaper than individual sorts on partitions + incremental > sorts, except when the the whole sort would spill to disk much more than the > incremental

Re: Allow ordered partition scans in more cases

2023-02-22 Thread Ronan Dunklau
Thank you for improving this optimization ! Le mardi 21 février 2023, 04:14:02 CET David Rowley a écrit : > I still need to look to see if there's some small amount of data that > can be loaded into the table to help coax the planner into producing > the ordered scan for this one. It works fine

Allow ordered partition scans in more cases

2023-02-20 Thread David Rowley
Over on [1], Benjamin highlighted that we don't do ordered partition scans in some cases where we could. Basically, what was added in 959d00e9d only works when at least one child path has pathkeys that suit the required query pathkeys. If the partitions or partitioned table does not have an