On 15 November 2012 16:09, Robert Haas <robertmh...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers