pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #13672: What is the purpose of the temp_buffers setting?
3+ messages / 3 participants
[nested] [flat]
* BUG #13672: What is the purpose of the temp_buffers setting?
@ 2015-10-09 23:46 jkoceniak@mediamath.com
2015-10-12 13:37 ` Re: BUG #13672: What is the purpose of the temp_buffers setting? Kevin Grittner <kgrittn@ymail.com>
0 siblings, 1 reply; 3+ messages in thread
From: jkoceniak@mediamath.com @ 2015-10-09 23:46 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 13672
Logged by: Jamie K
Email address: jkoceniak@mediamath.com
PostgreSQL version: 9.1.14
Operating system: Debian GNU/Linux 7 (wheezy)
Description:
I set temp_buffers to a high value (8GB). My understanding was that
temporary tables stay in memory if they do not go over temp_buffers limit.
However, I noticed that any temporary tables that I create are written to
disk. (i.e. I see t181_869525834 filenames in the data directory)
Also, I don't see any query performance improvements when querying temporary
tables using a higher temp_buffers value.
What is the purpose of this setting and what performance improvements would
you expect to see by adjusting the temp_buffers value?
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13672: What is the purpose of the temp_buffers setting?
2015-10-09 23:46 BUG #13672: What is the purpose of the temp_buffers setting? jkoceniak@mediamath.com
@ 2015-10-12 13:37 ` Kevin Grittner <kgrittn@ymail.com>
2015-10-12 13:43 ` Re: BUG #13672: What is the purpose of the temp_buffers setting? Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Grittner @ 2015-10-12 13:37 UTC (permalink / raw)
To: jkoceniak@mediamath.com <jkoceniak@mediamath.com>; pgsql-bugs
On Friday, October 9, 2015 11:34 PM, "jkoceniak@mediamath.com"
<jkoceniak@mediamath.com> wrote:
> I set temp_buffers to a high value (8GB). My understanding was
> that temporary tables stay in memory if they do not go over
> temp_buffers limit.
Since temp_buffers is a limit on how much process-local memory each
connection can reserve for temporary table buffers, 8GB seems like
an insanely high value. Keep in mind that once a connection
allocates memory for this purpose, it doesn't release it until the
connection is closed, so with this setting, if you had 100
connections open which had all used temporary tables, you might
have 800GB set aside for this purpose even if all of the
connections were idle and had dropped all of their temporary
tables.
> However, I noticed that any temporary tables that I create are
> written to disk. (i.e. I see t181_869525834 filenames in the data
> directory)
Are you sure that those temporary files are related to temporary
tables? temp_buffers is only for pages in temporary tables, not
for the temporary work files created by sorts, hash joins, CTEs,
etc. Those spill to disk if work_mem is not adequate to hold them.
> Also, I don't see any query performance improvements when
> querying temporary tables using a higher temp_buffers value.
Keep in mind that even if a temporary table doesn't fit into
temp_buffers, the OS cache will tend to cache it for some period of
time, so you are likely only dealing with difference between
accessing the pages in process-local memory versus bringing them in
from the OS RAM cache. That might be hard to measure.
> What is the purpose of this setting and what performance
> improvements would you expect to see by adjusting the
> temp_buffers value?
Personally, I would tend to think that the cases in which
increasing this setting would show any improvement would be few and
far between. I think that the default setting is probably too
high, especially for anyone who increases max_connections from the
default of 100. The setting you have, combined with
max_connections of 1000 could tie up 8TB in this type of cache, for
very dubious benefit.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13672: What is the purpose of the temp_buffers setting?
2015-10-09 23:46 BUG #13672: What is the purpose of the temp_buffers setting? jkoceniak@mediamath.com
2015-10-12 13:37 ` Re: BUG #13672: What is the purpose of the temp_buffers setting? Kevin Grittner <kgrittn@ymail.com>
@ 2015-10-12 13:43 ` Andres Freund <andres@anarazel.de>
0 siblings, 0 replies; 3+ messages in thread
From: Andres Freund @ 2015-10-12 13:43 UTC (permalink / raw)
To: Kevin Grittner <kgrittn@ymail.com>; +Cc: jkoceniak@mediamath.com <jkoceniak@mediamath.com>; pgsql-bugs
On 2015-10-12 13:37:16 +0000, Kevin Grittner wrote:
> Personally, I would tend to think that the cases in which
> increasing this setting would show any improvement would be few and
> far between.
Huh? If it's set to a small value and you write a bit of data all your
changes will more or less directly have to go to the OS. That can be a
massive performance problem, particularly if the workload has some
randomness to it.
I think memory overcommit pretty much "saves" you from every process
using all the temporary memory unless needed. That's not to say it's a
good idea to set it to a large value in all sessions, but it's not
*THAT* bad.
Greetings,
Andres Freund
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2015-10-12 13:43 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09 23:46 BUG #13672: What is the purpose of the temp_buffers setting? jkoceniak@mediamath.com
2015-10-12 13:37 ` Kevin Grittner <kgrittn@ymail.com>
2015-10-12 13:43 ` Andres Freund <andres@anarazel.de>
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