From: | Andrei Lepikhov <lepihov(at)gmail(dot)com> |
---|---|
To: | Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru> |
Cc: | Andy Fan <zhihuifan1213(at)163(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Nikita Malakhov <HukuToc(at)gmail(dot)com> |
Subject: | Re: MergeAppend could consider sorting cheapest child path |
Date: | 2025-04-29 13:52:40 |
Message-ID: | 96a96663-a58e-4835-920e-a000bfb20d6e@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 4/25/25 17:13, Andrei Lepikhov wrote:
> On 4/25/25 11:16, Alexander Pyhalov wrote:
>> Usually, sorted cheapest_total_path will be cheaper than sorted
>> fractional/startup path at least by startup cost (as after sorting it
>> includes total_cost of input path). But we ignore this case when
>> selecting cheapest_startup and cheapest_fractional subpaths. As result
>> selected cheapest_startup and cheapest_fractional can be not cheapest
>> for startup or selecting a fraction of rows.
> I don't know what you mean by that. The cheapest_total_path is
> considered when we chose optimal cheapest_total path. The same works for
> the fractional path - get_cheapest_fractional_path gives us the most
> optimal fractional path and probes cheapest_total_path too.
> As above, not sure about min-startup case for now. I can imagine
> MergeAppend over sophisticated subquery: non-sorted includes highly
> parameterised JOINs and the alternative (with pathkeys) includes
> HashJoin, drastically increasing startup cost. It is only a theory, of
> course. So, lets discover how min-startup works.
After a second thought I have caught your idea. I agree that for a
fractional path it have no sense to choose any other path except a
cheapest total one.
There are the modified patch in the attachment.
Also, to be more objective, I propose to use examples in argumentation -
something like in attached test2.sql script.
--
regards, Andrei Lepikhov
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Consider-explicit-sort-of-the-MergeAppend-subpath.patch | text/x-patch | 28.0 KB |
test2.sql | application/sql | 5.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Matheus Alcantara | 2025-04-29 13:56:36 | Re: RFC: Additional Directory for Extensions |
Previous Message | Matheus Alcantara | 2025-04-29 13:49:09 | Re: extension_control_path and "directory" |