From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: pgsql-performance@postgresql.org
Subject: Re: Do work_mem and shared buffers have 1g or 2g limit on 64 bit linux?
Date: Mon, 15 Jun 2015 16:57:53 +0200
Message-ID: <557EE7F1.9000901@2ndquadrant.com> (raw)
In-Reply-To: <CAAkGvS84ZcPGLxvXqkPzv=1VXELuT+ViDgh5CNWmY-gDkDdF=Q@mail.gmail.com>
References: <CAAkGvS-Ck3NoMz0i7Y__+2u2LOZzZexznRiZYy1eKdrEW5qU6Q@mail.gmail.com>
<557C6BA8.7030805@commandprompt.com>
<557C7213.8000704@joeconway.com>
<CAAkGvS84ZcPGLxvXqkPzv=1VXELuT+ViDgh5CNWmY-gDkDdF=Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
On 06/15/15 05:44, Kaijiang Chen wrote:
> I've checked the source codes in postgresql 9.2.4. In function
> static bool
> grow_memtuples(Tuplesortstate *state)
>
> the codes:
> /*
> * On a 64-bit machine, allowedMem could be high enough to get us into
> * trouble with MaxAllocSize, too.
> */
> if ((Size) (state->memtupsize * 2) >= MaxAllocSize / sizeof(SortTuple))
> return false;
>
> Note that MaxAllocSize == 1GB - 1
> that means, at least for sorting, it uses at most 1GB work_mem! And
> setting larger work_mem has no use at all...
That's not true. This only limits the size of 'memtuples' array, which
only stores pointer to the actual tuple, and some additional data. The
tuple itself is not counted against MaxAllocSize directly. The SortTuple
structure has ~24B which means you can track 33M tuples in that array,
and the tuples may take a lot more space.
regards
--
Tomas Vondra http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tomas.vondra@2ndquadrant.com
Subject: Re: Do work_mem and shared buffers have 1g or 2g limit on 64 bit linux?
In-Reply-To: <557EE7F1.9000901@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox