A server parameter determining how much space can be used for temporary files

temp_file_limit is a configuration parameter determining the maximum amount of disk space that a process can use for temporary files.

temp_file_limit was added in PostgreSQL 9.2.

Default value

The default value for temp_file_limit is: -1 (no limit)


If a non-zero value is set for temp_file_limit, any transaction which generates temporary files exceeding that size will be cancelled.

Note that if the value for temp_file_limit is set without specifying units, it  is assumed to be in kilobytes.

Change history


Executing a transaction which generates temporary files exceeding the (artificially low) setting of 1kb:

postgres=# SELECT * FROM foo f JOIN foo g ON f.id = g.id;
ERROR:  temporary file size exceeds temp_file_limit (1kB)


GUC configuration item, Memory

See also

max_files_per_process, log_temp_files