Re: tuplesort memory usage: grow_memtuples

Peter Geoghegan <peter@2ndquadrant.com>

From: Peter Geoghegan <peter@2ndquadrant.com>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Jeff Janes <jeff.janes@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2012-10-16T12:42:46Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Incorporate a couple of recent tuplesort.c improvements into tuplestore.c.

On 14 October 2012 09:19, Simon Riggs <simon@2ndquadrant.com> wrote:
> This is a very useful optimisation, for both the low and the high end.

Well, I'm about ready to mark this one "ready for committer". There is
this outstanding issue in my revision of August 17th, though:

+ 		/*
+ 		 * XXX: This feels quite brittle; is there a better principled approach,
+ 		 * that does not violate modularity?
+ 		 */
+ 		newmemtupsize = (int) floor(oldmemtupsize * allowedMem / memNowUsed);
+ 		state->fin_growth = true;

I suppose that I should just recognise that this *is* nothing more
than a heuristic, and leave it at that.

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