pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Changing work_mem
Date: Tue, 13 Aug 2019 11:21:04 -0600
Message-ID: <0066b922-7671-c4c0-4367-183778b9e5d7@gmail.com> (raw)
In-Reply-To: <9c6b069a-c99b-4b65-92fa-59404012e576@mail.ru>
References: <2cbec921-a0c2-016f-1831-82dd45106af3@mail.ru>
	<ea6b62a3-4aff-cba4-df02-d323073dcbce@2ndquadrant.com>
	<6d170b3b-17b7-8e02-bbf6-2a6885b317eb@mail.ru>
	<CAKoxK+6ptxsmNegLmwBEDfBNvEAExDzrd8fthp6T5GwgMoggfw@mail.gmail.com>
	<50c20aea-6f63-2cf7-1760-bb28679ff3e7@mail.ru>
	<9c6b069a-c99b-4b65-92fa-59404012e576@mail.ru>


On 8/13/19 11:04 AM, rihad wrote:
> On 08/13/2019 08:44 PM, rihad wrote:
>> On 08/13/2019 08:22 PM, Luca Ferrari wrote:
>>> On Tue, Aug 13, 2019 at 5:59 PM rihad <rihad@mail.ru> wrote:
>>>> [dbname] LOG:  temporary file: path
>>>> "base/pgsql_tmp/pgsql_tmp93683.257381", size 594
>>>>
>>> The setting 'work_mem' is within context 'user', that means it will
>>> affect running sessione unless the session itself has already issued a
>>> SET work_mem to xxx.
>>> So this could be a reason why you don't seem to see any change.
>>>
>>> Also keep in mind that work_mem work on a connection basis, so you are
>>> going to possibly see 521MB x num_connections if all your clients are
>>> doig the same kind of sort concurrently, which probably causes
>>> PostgreSQL to go to disk due to memory unavailable.
>>>
>>> Hope this helps.
>>> Luca
>>> .
>>>
>> Thanks. The box has 15GB mem free (as in FreeBSD )))
>>
>> And it hasn't moved a notch after the increase.
>>
>> No code does SET work_mem=... AFAIK.
>>
>> My apologies to Mr. Peter but I still think that older processes, 
>> some of them started a couple of weeks ago, use the older setting.
> Sorry, I just decreased work_mem back to 256MB, reloaded, and 
> instantly started seeing 82mb temp file creation, not 165mb as was 
> usual with work_mem=512MB.
>
> So it indeed was applied immediately.
> Really weird figures )
>
>
The files are written because work-mem was insufficient to complete the 
task at hand, so some data was flushed to disk, more data read into 
memory, processed and eventually all merged into final result.  Larger 
work-mem means more to flush, but less often.







view thread (10+ messages)  latest in thread

Message-ID: <0066b922-7671-c4c0-4367-183778b9e5d7@gmail.com>
Permalink:  ../0066b922-7671-c4c0-4367-183778b9e5d7@gmail.com/
Also on:    postgresql.org/message-id/0066b922-7671-c4c0-4367-183778b9e5d7@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: robjsargent@gmail.com
  Subject: Re: Changing work_mem
  In-Reply-To: <0066b922-7671-c4c0-4367-183778b9e5d7@gmail.com>
  References: <2cbec921-a0c2-016f-1831-82dd45106af3@mail.ru> <ea6b62a3-4aff-cba4-df02-d323073dcbce@2ndquadrant.com> <6d170b3b-17b7-8e02-bbf6-2a6885b317eb@mail.ru> <CAKoxK+6ptxsmNegLmwBEDfBNvEAExDzrd8fthp6T5GwgMoggfw@mail.gmail.com> <50c20aea-6f63-2cf7-1760-bb28679ff3e7@mail.ru> <9c6b069a-c99b-4b65-92fa-59404012e576@mail.ru> <0066b922-7671-c4c0-4367-183778b9e5d7@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