> On Jul 22, 2024, at 8:54 AM, Tom Lane <tgl@xxxxxxxxxxxxx> wrote: > > You would get more specific answers if you provided an example of the > queries that cause this, with EXPLAIN ANALYZE output. But I think a > likely bet is that it's doing a hash join that overruns work_mem. > What will happen is that the join gets divided into batches based on > hash codes, and each batch gets dumped into its own temp files (one > per batch for each side of the join). It would not be too surprising > if some of the batches are small, thanks to the vagaries of hash > values. Certainly they could be less than work_mem, since the only > thing we can say for sure is that the sum of the temp file sizes for > the inner side of the join should exceed work_mem. OK, that makes total sense, and fits our usage patterns. (Lots of complex queries, lots of hash joins.) thanks