pgsql: Pack tuples in a hash join batch densely, to save memory.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Pack tuples in a hash join batch densely, to save memory.
Date: 2014-09-10 18:25:07
Message-ID: E1XRmZn-0002EE-Pc@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Pack tuples in a hash join batch densely, to save memory.

Instead of palloc'ing each HashJoinTuple individually, allocate 32kB chunks
and pack the tuples densely in the chunks. This avoids the AllocChunk
header overhead, and the space wasted by standard allocator's habit of
rounding sizes up to the nearest power of two.

This doesn't contain any planner changes, because the planner's estimate of
memory usage ignores the palloc overhead. Now that the overhead is smaller,
the planner's estimates are in fact more accurate.

Tomas Vondra, reviewed by Robert Haas.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/45f6240a8fa9d35548eb2ef23dba2c11540aa02a

Modified Files
--------------
src/backend/executor/nodeHash.c | 151 +++++++++++++++++++++++++++++++--------
src/include/executor/hashjoin.h | 22 ++++++
2 files changed, 145 insertions(+), 28 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2014-09-10 18:41:21 pgsql: Fix thinko in 0709b7ee72e4bc71ad07b7120acd117265ab51d0.
Previous Message Andres Freund 2014-09-10 15:26:30 pgsql: Add support for optional_argument to our own getopt_long() imple