Michael Lewis <mlewis@xxxxxxxxxxx> 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