[PATCHES] Buglet in "Sort Method" explain output in degenerate case

2007-09-01 Thread Gregory Stark
I noticed a small bug in the "Sort Method" code: postgres=# explain analyze select * from test order by random() limit 1; QUERY PLAN

Re: [PATCHES] Buglet in "Sort Method" explain output in degenerate case

2007-09-01 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> 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

Re: [PATCHES] Buglet in "Sort Method" explain output in degenerate case

2007-09-01 Thread Tom Lane
I wrote: > Hmm. Actually, given that sort_bounded_heap() is only conditionally > invoked, *both* of the state updates it makes are bogus. Er, make that three state updates: its REVERSEDIRECTION() operation is being skipped as well. That's not critical now, but might be someday. Rather than movi

Re: [PATCHES] Buglet in "Sort Method" explain output in degenerate case

2007-09-01 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > 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. Actually that would be pretty easy to do and s