Parameter · Developer Options
remove_temp_files_after_crash
Remove temporary files after backend crash.
- Default:
on - Type: bool
- Applies: Reload
In plain words
Sorts and hashes that do not fit in memory write temporary files. If a backend crashes, its temp files are orphaned. By default PostgreSQL deletes them during the crash restart; turning this off keeps them for inspection.
For DBAs and operators
Added in PostgreSQL 14 (before that, orphaned temp files were only removed at a full server restart). Temp files live in base/pgsql_tmp/ (or pgsql_tmp inside each tablespace listed in temp_tablespaces) with names like pgsql_tmp4711.0.
Keep it on in production: after repeated crashes, leftover files can be large (a hash join may have spilled gigabytes) and can fill the disk, causing more failures. Turn it off only while a developer needs the files.
Support tip: large files in pgsql_tmp on a running server usually belong to live queries; check pg_ls_tmpdir() and log_temp_files before deleting anything by hand.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().
See it in context
Crash recovery Local (per-backend) memory Physical layout on disk
Related parameters
restart_after_crash temp_tablespaces temp_file_limit log_temp_files