Skip site navigation (1) Skip section navigation (2)

Re: tuplesort memory usage: grow_memtuples

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tuplesort memory usage: grow_memtuples
Date: 2012-11-15 17:29:19
Message-ID: CAEYLb_UmQQLzgquM8b-fpgKKHLPpQGjw3mvZThFEtsXNJ=Ze5A@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On 15 November 2012 16:09, Robert Haas <robertmhaas(at)gmail(dot)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


In response to

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2012-11-15 17:53:15
Subject: another idea for changing global configuration settings from SQL
Previous:From: Peter GeogheganDate: 2012-11-15 17:14:54
Subject: Re: tuplesort memory usage: grow_memtuples

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group