{"Entry":{"collection":"guc","key":"data_directory","name":"data_directory","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"File Locations","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"7.4","status":"added","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"}],"content_hash":"12a44a0f2ee515d72fc27b83aaa7cfa26eacd1288c6581d874a0d1fd4a5edb41","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"Not specified"}],"derived_content_hash":"58f5a38ea267e75c48a341cf7a605e2ef20b675c74c0f0778feb1275cad21c57","editorial":{"advice":{"olap":"Follow the OLTP rule, and for separate mounts also verify boot ordering, backup coverage, and path consistency on failover nodes.","oltp":"data_directory is deployment topology, not workload tuning. Use an absolute path, least privilege, and atomic configuration rollout; verify access as the postgres service account before restart/reload.","small":"The default co-located layout is simplest. Split paths only for a concrete backup, packaging, or permission-isolation benefit."},"mechanism":["Sets the server's data directory. The value is fixed when the server starts, so changing it requires a restart.","This selects the cluster storage directory and overrides -D or PGDATA for data placement, but it does not relocate the already selected configuration files. Moving a cluster requires a coordinated shutdown and filesystem operation; changing only the string cannot move data.","Monitor and change data_directory together with allow_alter_system, config_file, hba_file. Validate on the relevant server role and real workload, then use its postmaster context to choose session change, reload, or restart; a historical boot default is not the current effective value."],"pitfalls":["Missing directory traversal, read, or write permission for the service account.","Confusing restart requirements for a path with reload behavior of the selected file contents.","Omitting the path on a failover node or from backup inventory.","Using a relative path that depends on an unstable working directory."],"references":[{"title":"PostgreSQL 19 Beta 4: data_directory","url":"https://www.postgresql.org/docs/19/runtime-config-file-locations.html#GUC-DATA-DIRECTORY"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["allow_alter_system","config_file","hba_file","ident_file","external_pid_file","extension_destdir"],"summary":"data_directory — Sets the server's data directory. Observed in PG9.0–19 Beta 4; its last measured boot default is not set in PG19 Beta 4, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"8.0","group":"File Locations","group_slug":"file-locations","imported_at":"2026-09-27T17:57:31.011269+08:00","intro_commit":{},"key":"data_directory","last_version":"20","max_val":"","min_val":"","name":"data_directory","position":77,"present_in":["8.0","8.1","8.2","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"],"repair_provenance":{"original_source_revision":"english-manuals:7068433dd8a244140f901006424222e5f04241b4aa0a915ecfbd85b591385ad1","receipt_sha256":"1bff12b93da0b9acb29e2cf82246399360ab19c4a03223a52069fff70f1a3859","repair":"wiki-repair-20261023"},"short_desc":"Specifies the directory to use for data storage.","short_desc_zh":"","source_rev":"wiki-repair-20261023:b3c91b26b2b9cd53bf326ba43190e0c3ff9d443a3e06b72b503ea4272bb0dc9b","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"data_directory","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"data_directory","SourceRevision":"wiki-repair-20261023:b3c91b26b2b9cd53bf326ba43190e0c3ff9d443a3e06b72b503ea4272bb0dc9b","Facts":{"boot_val":null,"category":"File Locations","context":"postmaster","description":"Specifies the directory to use for data storage. This parameter can only be set at server start.","description_zh":"指定用于数据存储的目录。这个参数只能在服务器启动时设置。","description_zh_html":"\u003cp\u003e\n         指定用于数据存储的目录。这个参数只能在服务器启动时设置。\n       \u003c/p\u003e","doc":{"anchor":"GUC-DATA-DIRECTORY","file":"runtime-config-file-locations.html","lang":"en","sha256":"d32b4a6043ad0ec1a0b4d476f80aa279be0a3491176860e0d2f2439eddf612ad","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"data_directory","short_desc":"Sets the server's data directory.","source":"pg-settings-source-snapshot","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-file-locations.html","sha256":"7b48da92800e911f199e0fad1ebdd75d67d4020daa084ee833257a688c248fab"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":null,"vartype":"string","zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"GUC-DATA-DIRECTORY","file":"runtime-config-file-locations.html","lang":"en","sha256":"d32b4a6043ad0ec1a0b4d476f80aa279be0a3491176860e0d2f2439eddf612ad","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"data_directory","SourceDatabase":"center","Version":"18","Locale":"en","Title":"data_directory","Summary":"Specifies the directory to use for data storage. This parameter can only be set at server start.","BodyHTML":"\u003cp\u003eSpecifies the directory to use for data storage. This parameter can only be set at server start.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:b3c91b26b2b9cd53bf326ba43190e0c3ff9d443a3e06b72b503ea4272bb0dc9b","ContentHash":"b688e3cd390f9ae040b2a3f82994e649f0f2a35139d90c05cca0a78a41b66585","Payload":{"description":"Specifies the directory to use for data storage. This parameter can only be set at server start."}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
