{"Entry":{"collection":"guc","key":"stats_temp_directory","name":"stats_temp_directory","aliases":[],"metadata":{"baseline":false,"boot_human":"pg_stat_tmp","boot_val":"pg_stat_tmp","category":"Statistics / Query and Index Statistics Collector","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"8.3","status":"added","to":"8.4"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":false,"fields":{},"from":"14","status":"removed","to":"15"}],"content_hash":"f3367d8f30ec25111c58f1aa3ac7d130bceb8630a541dab2c24382b74464601b","context":"sighup","default_changed_in":[],"default_history":[{"from":"9.0","to":"14","value":"pg_stat_tmp"}],"editorial":{"advice":{"olap":"Do not carry stats_temp_directory into a modern analytical cluster. Benchmark the supported current mechanisms instead of trying to emulate a removed implementation detail.","oltp":"Do not tune stats_temp_directory on current PostgreSQL: remove it from upgrade targets and use the current replacement behavior described above. Retain it only when reproducing the historical version.","small":"Delete stats_temp_directory during version migration; an unknown-parameter startup failure is more likely than a benefit. Historical test instances should keep the old upstream default."},"mechanism":["Through PG14, stats_temp_directory selected where the old statistics collector wrote temporary statistics files. It did not store durable table statistics created by ANALYZE.","A fast local memory-backed directory could reduce collector file I/O, but loss of its temporary contents was expected. Permissions and directory availability still had to permit the server to operate.","PostgreSQL 15 replaced the collector's file-based architecture with shared-memory cumulative statistics and removed this GUC. PG15+ migrations must delete the setting rather than map it to another directory. Its SIGHUP context allows configuration reload without a server restart."],"pitfalls":["Changing stats_temp_directory without applying its documented unit and configuration context.","Optimizing an isolated benchmark while ignoring concurrent aggregate resource use.","Assuming a configured value guarantees operating-system or storage behavior.","Failing to retest startup, failover, and workload latency after the change."],"references":[{"title":"PostgreSQL 14: stats_temp_directory","url":"https://www.postgresql.org/docs/14/runtime-config-statistics.html#GUC-STATS-TEMP-DIRECTORY"}],"related":["stats_fetch_consistency","track_counts","track_activities","data_directory"],"summary":"stats_temp_directory — Writes temporary statistics files to the specified directory. Observed in PG9.0–14; its last measured boot default is pg_stat_tmp in PG14, with sighup context. It was removed in PG15."},"enumvals":[],"first_version":"8.4","group":"Statistics","group_slug":"statistics","imported_at":"2026-09-27T17:57:32.076916+08:00","intro_commit":{},"key":"stats_temp_directory","last_version":"14","max_val":"","min_val":"","name":"stats_temp_directory","position":392,"present_in":["8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14"],"short_desc":"Sets the directory to store temporary statistics data in.","short_desc_zh":"","source_rev":"english-manuals:a18b394a3a4f43bed44f4288f97310b233b08ff04ab0b0268e20129b6183338b","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"stats_temp_directory","SourceDatabase":"center","Version":"14","SourceTable":"guc","SourceKey":"stats_temp_directory","SourceRevision":"english-manuals:a18b394a3a4f43bed44f4288f97310b233b08ff04ab0b0268e20129b6183338b","Facts":{"boot_val":"pg_stat_tmp","category":"Statistics / Query and Index Statistics Collector","context":"sighup","description":"Sets the directory to store temporary statistics data in. This can be a path relative to the data directory or an absolute path. The default is pg_stat_tmp. Pointing this at a RAM-based file system will decrease physical I/O requirements and can lead to improved performance. This parameter can only be set in the postgresql.conf file or on the server command line.","doc":{"anchor":"GUC-STATS-TEMP-DIRECTORY","file":"runtime-config-statistics.html","lang":"en","sha256":"96dd943ef801cbe4de7d2aa75c353df41e123ca57d0c856539b274a9615bdf5c","slug":"14"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"14","min_val":null,"name":"stats_temp_directory","short_desc":"Writes temporary statistics files to the specified directory.","source":"pg-settings-source-snapshot","unit":null,"vartype":"string"},"ManualEvidence":{"doc":{"anchor":"GUC-STATS-TEMP-DIRECTORY","file":"runtime-config-statistics.html","lang":"en","sha256":"96dd943ef801cbe4de7d2aa75c353df41e123ca57d0c856539b274a9615bdf5c","slug":"14"}},"MeasuredEvidence":{"metadata_version":"14"}},"Text":{"Collection":"guc","Key":"stats_temp_directory","SourceDatabase":"center","Version":"14","Locale":"en","Title":"stats_temp_directory","Summary":"Sets the directory to store temporary statistics data in. This can be a path relative to the data directory or an absolute path. The default is pg_stat_tmp. Pointing this at a RAM-based file system will decrease physical I/O requirements and can lead to improved performance. This parameter can only be set in the postgresql.conf file or on the server command line.","BodyHTML":"\u003cp\u003eSets the directory to store temporary statistics data in. This can be a path relative to the data directory or an absolute path. The default is pg_stat_tmp. Pointing this at a RAM-based file system will decrease physical I/O requirements and can lead to improved performance. This parameter can only be set in the postgresql.conf file or on the server command line.\u003c/p\u003e","SourceRevision":"english-manuals:a18b394a3a4f43bed44f4288f97310b233b08ff04ab0b0268e20129b6183338b","ContentHash":"747120a06eb785a691faa226a1c6849bb6822d4e591f3efebaa732472d56fe16","Payload":{"description":"Sets the directory to store temporary statistics data in. This can be a path relative to the data directory or an absolute path. The default is pg_stat_tmp. Pointing this at a RAM-based file system will decrease physical I/O requirements and can lead to improved performance. This parameter can only be set in the postgresql.conf file or on the server command line."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","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}
