pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
temp_buffers and work_mem and big temp tables
3+ messages / 3 participants
[nested] [flat]

* temp_buffers and work_mem and big temp tables
@ 2020-11-10 18:53 Wells Oliver <wells.oliver@gmail.com>
  2020-11-10 19:04 ` Re: temp_buffers and work_mem and big temp tables David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Wells Oliver @ 2020-11-10 18:53 UTC (permalink / raw)
  To: pgsql-admin

Hey all: I was wondering if someone might spell out which setting has more
impact on temporary tables being stored in memory versus disk? I have read
the docs but I thought I'd reach out and ask the community: I keep
increasing both in some scripts where Large Temp Tables are created, but
I'm wondering if it's more efficient just to use one or the other.

Thank you.

-- 
Wells Oliver
wells.oliver@gmail.com <wellsoliver@gmail.com>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: temp_buffers and work_mem and big temp tables
  2020-11-10 18:53 temp_buffers and work_mem and big temp tables Wells Oliver <wells.oliver@gmail.com>
@ 2020-11-10 19:04 ` David G. Johnston <david.g.johnston@gmail.com>
  2020-11-10 19:32   ` Re: temp_buffers and work_mem and big temp tables Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2020-11-10 19:04 UTC (permalink / raw)
  To: Wells Oliver <wells.oliver@gmail.com>; +Cc: pgsql-admin

On Tuesday, November 10, 2020, Wells Oliver <wells.oliver@gmail.com> wrote:

> Hey all: I was wondering if someone might spell out which setting has more
> impact on temporary tables being stored in memory versus disk? I have read
> the docs but I thought I'd reach out and ask the community: I keep
> increasing both in some scripts where Large Temp Tables are created, but
> I'm wondering if it's more efficient just to use one or the other.
>

IIUC work_mem has nothing to do with temporary tables.  All tables have a
disk component and read/writes are done via buffers.

David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: temp_buffers and work_mem and big temp tables
  2020-11-10 18:53 temp_buffers and work_mem and big temp tables Wells Oliver <wells.oliver@gmail.com>
  2020-11-10 19:04 ` Re: temp_buffers and work_mem and big temp tables David G. Johnston <david.g.johnston@gmail.com>
@ 2020-11-10 19:32   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2020-11-10 19:32 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Wells Oliver <wells.oliver@gmail.com>; pgsql-admin

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tuesday, November 10, 2020, Wells Oliver <wells.oliver@gmail.com> wrote:
>> Hey all: I was wondering if someone might spell out which setting has more
>> impact on temporary tables being stored in memory versus disk? I have read
>> the docs but I thought I'd reach out and ask the community: I keep
>> increasing both in some scripts where Large Temp Tables are created, but
>> I'm wondering if it's more efficient just to use one or the other.

> IIUC work_mem has nothing to do with temporary tables.  All tables have a
> disk component and read/writes are done via buffers.

The temp_buffers setting controls how much temporary-table data can be
kept in a session's memory.  If you get to more than that, it spills out
to disk (or at least to the kernel's disk buffers).

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-11-10 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 18:53 temp_buffers and work_mem and big temp tables Wells Oliver <wells.oliver@gmail.com>
2020-11-10 19:04 ` David G. Johnston <david.g.johnston@gmail.com>
2020-11-10 19:32   ` Tom Lane <tgl@sss.pgh.pa.us>

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