Re: PoC: Partial sort - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: PoC: Partial sort
Date
Msg-id CAPpHfdvrhbv+gGbLDsDFJY9Ln1ei4M2WiGnRzuZUnGGW_cfKZQ@mail.gmail.com
Whole thread Raw
In response to Re: PoC: Partial sort  (Marti Raudsepp <marti@juffo.org>)
List pgsql-hackers
On Thu, Feb 13, 2014 at 1:54 AM, Marti Raudsepp <marti@juffo.org> wrote:
I think the 1st patch now has a bug in initial_cost_mergejoin; you
still pass the "presorted_keys" argument to cost_sort, making it
calculate a partial sort cost, but generated plans never use partial
sort. I think 0 should be passed instead. Patch attached, needs to be
applied on top of partial-sort-basic-1 and then reverse-applied on
partial-sort-merge-1.

It doesn't look so for me. Merge join doesn't find partial sort especially. But if path with some presorted pathkeys will be accidentally selected then partial sort will be used. See create_mergejoin_plan function. So, I think this cost_sort call is relevant to create_mergejoin_plan. If we don't want partial sort to be used in such rare cases then we should revert it from both places. However, I doubt that it does any overhead, so we can leave it as is.

------
With best regards,
Alexander Korotkov.   

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Selecting large tables gets killed
Next
From: Pavel Stehule
Date:
Subject: Re: Fwd: patch: make_timestamp function