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

pgsql: Reduce memory consumption inside inheritance_planner().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Reduce memory consumption inside inheritance_planner().
Date: 2010-12-05 20:11:03
Message-ID: E1PPKvH-0002Rq-Sc@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Reduce memory consumption inside inheritance_planner().

Avoid eating quite so much memory for large inheritance trees, by
reclaiming the space used by temporary copies of the original parsetree and
range table, as well as the workspace needed during planning.  The cost is
needing to copy the finished plan trees out of the child memory context.
Although this looks like it ought to slow things down, my testing shows
it actually is faster, apparently because fewer interactions with malloc()
are needed and/or we can do the work within a more readily cacheable amount
of memory.  That result might be platform-dependent, but I'll take it.

Per a gripe from John Papandriopoulos, in which it was pointed out that the
memory consumption actually grew as O(N^2) for sufficiently many child
tables, since we were creating N copies of the N-element range table.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=d1001a78ce612a16ea622b558f5fc2b68c45ab4c

Modified Files
--------------
src/backend/optimizer/plan/planner.c |   68 ++++++++++++++++++++++++++-------
1 files changed, 53 insertions(+), 15 deletions(-)

pgsql-committers by date

Next:From: Peter EisentrautDate: 2010-12-06 11:37:37
Subject: pgsql: Put only single space after "Sort Method:", for consistency
Previous:From: Tom LaneDate: 2010-12-04 18:48:04
Subject: pgsql: Fix two small bugs in new gistget.c logic.

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