pgsql: Permit super-MaxAllocSize allocations with MemoryContextAllocHug - Mailing list pgsql-committers

From Noah Misch
Subject pgsql: Permit super-MaxAllocSize allocations with MemoryContextAllocHug
Date
Msg-id E1UsHVS-0008A7-PC@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Permit super-MaxAllocSize allocations with MemoryContextAllocHug  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-committers
Permit super-MaxAllocSize allocations with MemoryContextAllocHuge().

The MaxAllocSize guard is convenient for most callers, because it
reduces the need for careful attention to overflow, data type selection,
and the SET_VARSIZE() limit.  A handful of callers are happy to navigate
those hazards in exchange for the ability to allocate a larger chunk.
Introduce MemoryContextAllocHuge() and repalloc_huge().  Use this in
tuplesort.c and tuplestore.c, enabling internal sorts of up to INT_MAX
tuples, a factor-of-48 increase.  In particular, B-tree index builds can
now benefit from much-larger maintenance_work_mem settings.

Reviewed by Stephen Frost, Simon Riggs and Jeff Janes.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/263865a48973767ce8ed7b7788059a38a24a9f37

Modified Files
--------------
src/backend/utils/mmgr/aset.c       |    5 ++
src/backend/utils/mmgr/mcxt.c       |   74 +++++++++++++++++++++++++---
src/backend/utils/sort/tuplesort.c  |   91 +++++++++++++++++++----------------
src/backend/utils/sort/tuplestore.c |   77 +++++++++++++++--------------
src/include/utils/memutils.h        |   28 ++++++-----
src/include/utils/palloc.h          |    4 ++
src/include/utils/tuplesort.h       |    2 +-
7 files changed, 183 insertions(+), 98 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Mark index-constraint comments with correct dependency in pg_dum
Next
From: Alvaro Herrera
Date:
Subject: pgsql: Update pg_resetxlog's documentation on multixacts