Re: PGSQL 11.4: shared_buffers and /dev/shm size

From: Konstantin Malanchev <hombit(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Jean Louis <bugs(at)gnu(dot)support>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: PGSQL 11.4: shared_buffers and /dev/shm size
Date: 2019-07-09 11:11:50
Message-ID: 825554F8-7D18-4DFA-B01F-5F3A47A66749@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)munro(at)gmail(dot)com> wrote:
>
> On Tue, Jul 9, 2019 at 10:15 PM Jean Louis <bugs(at)gnu(dot)support> wrote:
>> * Konstantin Malanchev <hombit(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Munro 2019-07-09 11:54:40 Re: PGSQL 11.4: shared_buffers and /dev/shm size
Previous Message Thomas Munro 2019-07-09 10:51:51 Re: PGSQL 11.4: shared_buffers and /dev/shm size