Re: small temp files

From: Paul Smith* <paul(at)pscs(dot)co(dot)uk>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: small temp files
Date: 2024-07-22 13:34:09
Message-ID: fe4b82fa-9907-43f9-b6ff-e1cbc768158d@pscs.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 22/07/2024 14:28, Scott Ribe wrote:
> I understand those things--my question is why, with work_mem set to 128MB, I would see tiny temp files (7452 is common, as is 102, and I've seen as small as 51).
>
From the manual:

"Note that a complex query might perform several sort and hash
operations at the same time, with each operation generally being allowed
to use as much memory as this value specifies before it starts to write
data into temporary files. Also, several running sessions could be doing
such operations concurrently. Therefore, the total memory used could be
many times the value of|work_mem|; it is necessary to keep this fact in
mind when choosing the value. Sort operations are used for|ORDER
BY|,|DISTINCT|, and merge joins. Hash tables are used in hash joins,
hash-based aggregation, memoize nodes and hash-based processing
of|IN|subqueries."

So, if it's doing lots of joins, there may be lots of bits of temporary
data which together add up to more than work_mem. AIUI PostgreSQL
doesn't necessarily shove all the temporary data for one query into one
file, it may have multiple smaller files for the data for a single query.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Antoine Dussarps 2024-07-22 13:36:42 [Help Request][dpage/pgadmin4] - Issue with docker image and SSO - OSError: Could not find a suitable TLS CA certificate bundle, invalid path: False
Previous Message Scott Ribe 2024-07-22 13:28:45 Re: small temp files