Re: Buglet in "Sort Method" explain output in degenerate case - Mailing list pgsql-patches

From Tom Lane
Subject Re: Buglet in "Sort Method" explain output in degenerate case
Date
Msg-id 22961.1188670793@sss.pgh.pa.us
Whole thread Raw
In response to Buglet in "Sort Method" explain output in degenerate case  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Buglet in "Sort Method" explain output in degenerate case  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Buglet in "Sort Method" explain output in degenerate case  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-patches
Gregory Stark <stark@enterprisedb.com> writes:
> It's printing "quicksort" even though it used a heap. This happens because we
> don't bother deheapifying a singleton heap so the boundUsed flag never gets
> set. The patch below just moves setting that flag to when the heap is made
> instead of when it's deheapified.

Hmm.  Actually, given that sort_bounded_heap() is only conditionally
invoked, *both* of the state updates it makes are bogus.  But I think
they should both be done at the call site in tuplesort_performsort.
(The state->status update already is, which is why it works at all.)
Setting it at conclusion is correct, I think, since if we ever changed
the code to abandon TSS_BOUNDED state in the face of unexpected memory
growth, it would be wrong to have set it in make_bounded_sort.

            regards, tom lane

pgsql-patches by date:

Previous
From: Gregory Stark
Date:
Subject: Buglet in "Sort Method" explain output in degenerate case
Next
From: Tom Lane
Date:
Subject: Re: Buglet in "Sort Method" explain output in degenerate case