From: Laurenz Albe <laurenz.albe@cybertec.at>
To: rihad <rihad@mail.ru>
To: Luca Ferrari <fluca1978@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-general General <pgsql-general@postgresql.org>
Subject: Re: Changing work_mem
Date: Wed, 14 Aug 2019 09:42:48 +0200
Message-ID: <46a5322e766fddb15cae66b4ec852289379ef75e.camel@cybertec.at> (raw)
In-Reply-To: <fcc30166-08a4-5be3-0ef6-40c192e5c5e2@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>
<fcc30166-08a4-5be3-0ef6-40c192e5c5e2@mail.ru>
rihad wrote:
> > 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 )
>
> Increased work_mem to 768MB and start seeing temp file creation log
> entries 331MB in size.
>
> Bizzare ) It looks like the bigger it gets, the bigger temp files
> are
> created.
>
> Why not decrease it to 64mb then...
Temporary files are created whenever the data is estimated to not
fit into "work_mem". So it is unsurprising that you see bigger
temporary files being created if you increase "work_mem".
Big temporary files will also be created when "work_mem" is small,
but maybe they got lost in the noise of the smaller files.
You should have noticed that fewer files are created when you increase
"work_mem".
Another thing to notice is that the temporary files use another, more
compact format than the data in memory, so you need to increase
"work_mem" to more than X if you want to avoid temporary files
of size X.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
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: laurenz.albe@cybertec.at, rihad@mail.ru, fluca1978@gmail.com, peter.eisentraut@2ndquadrant.com
Subject: Re: Changing work_mem
In-Reply-To: <46a5322e766fddb15cae66b4ec852289379ef75e.camel@cybertec.at>
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> <fcc30166-08a4-5be3-0ef6-40c192e5c5e2@mail.ru> <46a5322e766fddb15cae66b4ec852289379ef75e.camel@cybertec.at>
* 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