<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/all-your-gucs-in-a-row-data-directory-nyewadaef" -->

---
title: All Your GUCs in a Row: data_directory | daily.dev
description: PostgreSQL&#x27;s `data_directory` GUC names the location of the cluster&#x27;s data directory ($PGDATA). It exists to solve a bootstrapping puzzle: when config files...
canonical: https://daily.dev/posts/all-your-gucs-in-a-row-data-directory-nyewadaef
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: All Your GUCs in a Row: data_directory | daily.dev
og:description: PostgreSQL&#x27;s `data_directory` GUC names the location of the cluster&#x27;s data directory ($PGDATA). It exists to solve a bootstrapping puzzle: when config files...
og:url: https://daily.dev/posts/all-your-gucs-in-a-row-data-directory-nyewadaef
og:image: https://api.daily.dev/og/posts/nYEwaDAef.png
og:image:alt: All Your GUCs in a Row: data_directory
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# All Your GUCs in a Row: data_directory

**[Planet PostgreSQL](https://daily.dev/sources/planet-postgresql)** · 4 min read · 0 upvotes · 0 comments

## Summary

PostgreSQL's `data_directory` GUC names the location of the cluster's data directory ($PGDATA). It exists to solve a bootstrapping puzzle: when config files are stored separately from data (as in Debian/Ubuntu packaging under /etc/postgresql), the `-D` flag points to the config directory while `data_directory` in postgresql.conf points to the actual data. This is why `data_directory` cannot be set via `ALTER SYSTEM` — that command writes to postgresql.auto.conf, which lives inside the data directory you'd be trying to locate. Companion parameters `config_file`, `hba_file`, and `ident_file` complete the split-config setup. For most users, no action is needed — distribution packaging handles this automatically. Use `SHOW data_directory` to find where your data actually lives.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://postgr.es/p/9lq>

## Similar posts on daily.dev

- [All Your GUCs in a Row: config\_file](https://daily.dev/posts/all-your-gucs-in-a-row-config-file-53spmxdlx) · Planet PostgreSQL · 0 upvotes · 0 comments
- [All Your GUCs in a Row: data\_directory\_mode](https://daily.dev/posts/all-your-gucs-in-a-row-data-directory-mode-bopbesycd) · Planet PostgreSQL · 0 upvotes · 0 comments
- [All Your GUCs in a Row: external\_pid\_file](https://daily.dev/posts/all-your-gucs-in-a-row-external-pid-file-t7mm1hv7k) · Planet PostgreSQL · 0 upvotes · 0 comments

---

Tags: [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/all-your-gucs-in-a-row-data-directory-nyewadaef)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"All Your GUCs in a Row: data_directory","url":"https://daily.dev/posts/all-your-gucs-in-a-row-data-directory-nyewadaef","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/all-your-gucs-in-a-row-data-directory-nyewadaef"},"datePublished":"2026-06-06T00:20:00.058Z","dateModified":"2026-06-06T00:20:22.301Z","description":"PostgreSQL's `data_directory` GUC names the location of the cluster's data directory ($PGDATA). It exists to solve a bootstrapping puzzle: when config files...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/bf485ab587291142e59e49d3771b8d97?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/bf485ab587291142e59e49d3771b8d97?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Planet PostgreSQL","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet PostgreSQL","logo":"https://media.daily.dev/image/upload/logos/placeholder.jpg","url":"https://daily.dev/sources/planet-postgresql"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/all-your-gucs-in-a-row-data-directory-nyewadaef","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"postgresql","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet PostgreSQL","item":"https://daily.dev/sources/planet-postgresql"},{"@type":"ListItem","position":3,"name":"All Your GUCs in a Row: data_directory"}]}
```

