{"Entry":{"collection":"guc","key":"log_temp_files","name":"log_temp_files","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Reporting and Logging / What to Log","category_zh":"","changed_in":["18"],"changes":[{"documentation_changed":false,"fields":{},"from":"8.2","status":"added","to":"8.3"},{"documentation_changed":true,"fields":{},"from":"8.3","status":"changed","to":"8.4"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":true,"fields":{},"from":"14","status":"changed","to":"15"},{"documentation_changed":true,"fields":{},"from":"15","status":"changed","to":"16"},{"documentation_changed":false,"fields":{"extra_desc":{"from":"Zero logs all files. The default is -1 (turning this feature off).","to":"-1 disables logging temporary files. 0 means log all temporary files."}},"from":"17","status":"changed","to":"18"}],"content_hash":"32417177d204c8ec1a10d9b597ef2a6b374c2e7da02e03fc0ea77d410db2731f","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"-1 kB"}],"editorial":{"advice":{"olap":"Analytical jobs can justify richer log_temp_files telemetry, but account for long statements, large bind values, and bursty completion patterns in the log pipeline.","oltp":"Tune log_temp_files against an explicit observability question and a measured log-volume budget. Prefer selective thresholds, sampling, or role-level overrides over indiscriminate capture.","small":"Keep log_temp_files useful but bounded: verify disk, collector, retention, and redaction capacity before increasing detail or frequency."},"mechanism":["log_temp_files logs the use of temporary files larger than this number of kilobytes. -1 disables logging temporary files. 0 means log all temporary files. A temporary file is reported when it is deleted, with its name and size; -1 disables records and zero includes every file.","log_temp_files is a SUPERUSER-context setting. Superuser or a role granted the appropriate SET privilege can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.","It changes emitted diagnostic data rather than query semantics, but volume, sensitive content, log_line_prefix, destinations, collector throughput, and retention determine operational cost and usefulness."],"pitfalls":["Changing log_temp_files in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.","Enabling richer logging without budgeting collector throughput, storage, retention, and downstream query cost.","Writing SQL text, bind values, identities, or host data without a redaction and access-control policy.","Changing log_temp_files globally without a rollback plan and a client or operational compatibility test."],"references":[{"title":"PostgreSQL 19 Beta 4: log_temp_files","url":"https://www.postgresql.org/docs/19/runtime-config-logging.html#GUC-LOG-TEMP-FILES"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["log_checkpoints","log_autovacuum_min_duration","log_lock_waits","log_lock_failures","log_replication_commands"],"summary":"log_temp_files is the PostgreSQL setting that controls whether PostgreSQL logs the use of temporary files larger than this number of kilobytes."},"enumvals":[],"first_version":"8.3","group":"Reporting and Logging","group_slug":"logging","imported_at":"2026-09-30T00:40:57.436641+08:00","intro_commit":{},"key":"log_temp_files","last_version":"20","max_val":"","min_val":"","name":"log_temp_files","position":252,"present_in":["8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"Controls logging of temporary file names and sizes.","short_desc_zh":"","source_rev":"english-manuals:09e688b8588e170d6660bb58ef55bb9cfa95e0859282149088c40427f8f34858","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"log_temp_files","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"log_temp_files","SourceRevision":"english-manuals:09e688b8588e170d6660bb58ef55bb9cfa95e0859282149088c40427f8f34858","Facts":{"boot_val":"-1","category":"Reporting and Logging / What to Log","context":"superuser","description":"Controls logging of temporary file names and sizes. Temporary files can be created for sorts, hashes, and temporary query results. If enabled by this setting, a log entry is emitted for each temporary file, with the file size specified in bytes, when it is deleted. A value of zero logs all temporary file information, while positive values log only files whose size is greater than or equal to the specified amount of data. If this value is specified without units, it is taken as kilobytes. The default setting is -1, which disables such logging. Only superusers and users with the appropriate SET privilege can change this setting.","doc":{"anchor":"GUC-LOG-TEMP-FILES","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"-1 disables logging temporary files. 0 means log all temporary files.","lang":"en","max_val":"2147483647","metadata_version":"18","min_val":"-1","name":"log_temp_files","short_desc":"Log the use of temporary files larger than this number of kilobytes.","source":"pg-settings-source-snapshot","unit":"kB","vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-LOG-TEMP-FILES","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"log_temp_files","SourceDatabase":"center","Version":"18","Locale":"en","Title":"log_temp_files","Summary":"Controls logging of temporary file names and sizes. Temporary files can be created for sorts, hashes, and temporary query results. If enabled by this setting, a log entry is emitted for each temporary file, with the file size specified in bytes, when it is deleted. A value of zero logs all temporary file information, while positive values log only files whose size is greater than or equal to the specified amount of data. If this value is specified without units, it is taken as kilobytes. The default setting is -1, which disables such logging. Only superusers and users with the appropriate SET privilege can change this setting.","BodyHTML":"\u003cp\u003eControls logging of temporary file names and sizes. Temporary files can be created for sorts, hashes, and temporary query results. If enabled by this setting, a log entry is emitted for each temporary file, with the file size specified in bytes, when it is deleted. A value of zero logs all temporary file information, while positive values log only files whose size is greater than or equal to the specified amount of data. If this value is specified without units, it is taken as kilobytes. The default setting is -1, which disables such logging. Only superusers and users with the appropriate SET privilege can change this setting.\u003c/p\u003e","SourceRevision":"english-manuals:09e688b8588e170d6660bb58ef55bb9cfa95e0859282149088c40427f8f34858","ContentHash":"18022cfa6d48cfbc500533703b4a79ed82e448d1dbfd6e16f762507f24f9cb68","Payload":{"description":"Controls logging of temporary file names and sizes. Temporary files can be created for sorts, hashes, and temporary query results. If enabled by this setting, a log entry is emitted for each temporary file, with the file size specified in bytes, when it is deleted. A value of zero logs all temporary file information, while positive values log only files whose size is greater than or equal to the specified amount of data. If this value is specified without units, it is taken as kilobytes. The default setting is -1, which disables such logging. Only superusers and users with the appropriate SET privilege can change this setting."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
