Re: tuplesort memory usage: grow_memtuples - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: tuplesort memory usage: grow_memtuples
Date
Msg-id CAEYLb_UmQQLzgquM8b-fpgKKHLPpQGjw3mvZThFEtsXNJ=Ze5A@mail.gmail.com
Whole thread Raw
In response to Re: tuplesort memory usage: grow_memtuples  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 15 November 2012 16:09, Robert Haas <robertmhaas@gmail.com> wrote:
> I'm still not too sure why this part is OK:
>
>         /* This may not be our first time through */
>         if (newmemtupsize <= memtupsize)
>             return false;
>
> Suppose we enlarge the memtuples array by something other than a
> multiple of 2, and then we kick out all of the tuples that are
> currently in memory and load a new group with a smaller average size.
> ISTM that it could now appear that the memtuples array can be useful
> further enlarged, perhaps by as little as one tuple, and that that
> this could happen repeatedly.  I think we should either refuse to grow
> the array unless we can increase it by at least, say, 10%, or else set
> a flag after the final enlargement that acts as a hard stop to any
> further growth.

I thought that the flag added to Tuplesortstate in earlier revisions
was a little bit ugly. I can see the concern though, and I suppose
that given the alternative is to add a heuristic, simply using a flag
may be the best way to proceed.

-- 
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: tuplesort memory usage: grow_memtuples
Next
From: Peter Eisentraut
Date:
Subject: another idea for changing global configuration settings from SQL