pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
work_mem, temp_buffers, and temp_file_limit
2+ messages / 2 participants
[nested] [flat]

* work_mem, temp_buffers, and temp_file_limit
@ 2021-01-20 20:30 Michael Lewis <mlewis@entrata.com>
  2021-01-20 20:35 ` Re: work_mem, temp_buffers, and temp_file_limit Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Michael Lewis @ 2021-01-20 20:30 UTC (permalink / raw)
  To: PostgreSQL General <pgsql-general@lists.postgresql.org>

I've read the documentation but am unclear on what memory is used when
temp_buffers are exceeded by temp tables that are created. Does that also
go towards temp_file_limit?

When are temp files (temp_file_limit) cleared out? If there is a big ugly
query that uses 8GB of a 10GB limit, and then another query in the same
connection wants to use 3GBs of temp files total, will it fail? Or will
those earlier temp files have been cleared  or otherwise be ignored?

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

* Re: work_mem, temp_buffers, and temp_file_limit
  2021-01-20 20:30 work_mem, temp_buffers, and temp_file_limit Michael Lewis <mlewis@entrata.com>
@ 2021-01-20 20:35 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-01-20 20:35 UTC (permalink / raw)
  To: Michael Lewis <mlewis@entrata.com>; +Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>

Michael Lewis <mlewis@entrata.com> writes:
> I've read the documentation but am unclear on what memory is used when
> temp_buffers are exceeded by temp tables that are created.

The data gets flushed out to disk storage, or at least kernel disk buffers
(I don't think we'll try to fsync it).

> Does that also go towards temp_file_limit?

No, a "temp file" is distinct from a temporary relation.  Temp files
are used for anonymous transient stuff like a hash join's hash table.

> When are temp files (temp_file_limit) cleared out?

At the end of the query that used them.

			regards, tom lane





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


end of thread, other threads:[~2021-01-20 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 20:30 work_mem, temp_buffers, and temp_file_limit Michael Lewis <mlewis@entrata.com>
2021-01-20 20:35 ` 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