pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Konstantin Malanchev <hombit@gmail.com>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Jean Louis <bugs@gnu.support>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: PGSQL 11.4: shared_buffers and /dev/shm size
Date: Tue, 9 Jul 2019 14:11:50 +0300
Message-ID: <825554F8-7D18-4DFA-B01F-5F3A47A66749@gmail.com> (raw)
In-Reply-To: <CA+hUKGJOj7qzDLxeFPVvto8YEWop6FSQoTYPO9Z6Ee=i-nPS_Q@mail.gmail.com>
References: <7E4D7DA4-E093-4F6A-AE8E-81A73B995A8D@gmail.com>
	<20190709095344.GK7323@protected.rcdrun.com>
	<63682227-874F-43A9-8879-DE875DE9BCC3@gmail.com>
	<20190709101514.GB10233@protected.rcdrun.com>
	<CA+hUKGJOj7qzDLxeFPVvto8YEWop6FSQoTYPO9Z6Ee=i-nPS_Q@mail.gmail.com>

Hello Thomas,

Thank you for explanation. work_mem = 512MB and max_parallel_workers_per_gather = 2 and I run only one Postgres instance and only one query. EXPLAIN shows "Workers Planned: 2" for this query. Why it can use more than 1GB of /dev/shm?


Konstantin

> On 9 Jul 2019, at 13:51, Thomas Munro <thomas.munro@gmail.com> wrote:
> 
> On Tue, Jul 9, 2019 at 10:15 PM Jean Louis <bugs@gnu.support> wrote:
>> * Konstantin Malanchev <hombit@gmail.com> [2019-07-09 12:10]:
>>> I have 8 GB RAM and /dev/shm size is 4GB, and there is no significant memory usage by other system processes. I surprised that Postgres uses more space in /dev/shm than sharred_buffers parameter allows, probably I don't understand what this parameter means.
>>> 
>>> I have no opportunity to enlarge total RAM and probably this query requires too much RAM to execute. Should Postgres just use HDD as temporary storage in this case?
>> 
>> That I cannot know. I know that /dev/shm could
>> grow as much as available free RAM.
> 
> Hi,
> 
> PostgreSQL creates segments in /dev/shm for parallel queries (via
> shm_open()), not for shared buffers.  The amount used is controlled by
> work_mem.  Queries can use up to work_mem for each node you see in the
> EXPLAIN plan, and for each process, so it can be quite a lot if you
> have lots of parallel worker processes and/or lots of
> tables/partitions being sorted or hashed in your query.
> 
> -- 
> Thomas Munro
> https://enterprisedb.com






view thread (10+ messages)  latest in thread

Message-ID: <825554F8-7D18-4DFA-B01F-5F3A47A66749@gmail.com>
Permalink:  ../825554F8-7D18-4DFA-B01F-5F3A47A66749@gmail.com/
Also on:    postgresql.org/message-id/825554F8-7D18-4DFA-B01F-5F3A47A66749@gmail.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: hombit@gmail.com, thomas.munro@gmail.com, bugs@gnu.support
  Subject: Re: PGSQL 11.4: shared_buffers and /dev/shm size
  In-Reply-To: <825554F8-7D18-4DFA-B01F-5F3A47A66749@gmail.com>
  References: <7E4D7DA4-E093-4F6A-AE8E-81A73B995A8D@gmail.com> <20190709095344.GK7323@protected.rcdrun.com> <63682227-874F-43A9-8879-DE875DE9BCC3@gmail.com> <20190709101514.GB10233@protected.rcdrun.com> <CA+hUKGJOj7qzDLxeFPVvto8YEWop6FSQoTYPO9Z6Ee=i-nPS_Q@mail.gmail.com> <825554F8-7D18-4DFA-B01F-5F3A47A66749@gmail.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