Configuration parameter

data_directory — PostgreSQL configuration parameter

Category File Locations Change scope Postmaster

Specifies the directory to use for data storage.

At a glance

Property Value
Parameter data_directory
Category File Locations
Default (see documentation)
Value type string
Change scope Server restart required (postgresql.conf)
Available in PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12)

What it does

Specifies the directory to use for data storage. This parameter can only be set at server start.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Set it in postgresql.conf (or with ALTER SYSTEM) and restart the server — this parameter cannot change without a restart.

Inspect the current value and source with SHOW data_directory; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'data_directory';.

Tuning guidance

This is a deployment path, not something you tune for performance. Set it once to match how the cluster is laid out on disk (or leave it at the packaged default), keep it consistent across restarts and replicas, and change it only when deliberately relocating files. A wrong path prevents the server from starting.

Reference

PostgreSQL documentation — data_directory.

Keep going

Related & next steps

Concepts on this page

Was this helpful?

← All configuration parameters