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

From Gregory Stark
Subject Re: Buglet in "Sort Method" explain output in degenerate case
Date
Msg-id 878x7qjev5.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Buglet in "Sort Method" explain output in degenerate case  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
"Tom Lane" <tgl@sss.pgh.pa.us> 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 strikes me as worth doing. It
isn't hard to contrive an example that over-runs work_mem though I'm not sure
how easy it would be to actually run out of RAM.

One thing though, we would have to let up on switching to bounded sort if we
run out of memory accumulating tuples. We wouldn't want to switch to bounded
sort and then spill to disk right afterward. Here I just added 10% assuming
usually the remaining tuples won't be 10% larger than the first batch.
Introducing floating point math in here kind of bothers me though.




--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

Attachment

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Buglet in "Sort Method" explain output in degenerate case
Next
From: Tom Lane
Date:
Subject: WIP patch for per-function GUC settings