Type: integer
Default: -1 (-1)
Min: -1 (-1)
Max: 2147483647 (2147483647kB)
Unit: KB
Context: superuser
Restart: false
Since: 9.2

Specifies the maximum amount of disk space that a process can use for temporary files, such as sort and hash temporary files, or the storage file for a held cursor. A transaction attempting to exceed this limit will be canceled. If this value is specified without units, it is taken as kilobytes. -1 (the default) means no limit. Only superusers can change this setting.

This setting constrains the total space used at any instant by all temporary files used by a given PostgreSQL process. It should be noted that disk space used for explicit temporary tables, as opposed to temporary files used behind-the-scenes in query execution, does not count against this limit.


… or something which is bigger than your largest possible sort, but not big enough to run you out of disk space.