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 moving all that up to tuplesort_performsort, it seems better to leave it where it is, and instead remove the premature optimization of trying to skip sort_bounded_heap. The number of cycles saved that way is tiny anyway... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match