Re: Buglet in "Sort Method" explain output in degenerate case

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: PostgreSQL-development Hackers <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Buglet in "Sort Method" explain output in degenerate case
Date: 2007-09-01 18:19:53
Message-ID: 22961.1188670793@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Gregory Stark <stark(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-09-01 18:50:05 Re: Buglet in "Sort Method" explain output in degenerate case
Previous Message Gregory Stark 2007-09-01 17:28:24 Buglet in "Sort Method" explain output in degenerate case