Database directory tree
With this background in mind, here are the major directories inside the PostgreSQL database structure that initdb
creates:
base
: This is the location that holdspg_default
, the default tablespace. The template databases and any additional ones created without an explicit tablespace assignment will all be placed here. The next chapter digs into the details of how thebase/
directory is organized into databases and tables.global
: Holds thepg_global
virtual tablespace. This is where system tables shared by all databases in a cluster, such as the database roles and other system catalog data, are stored.pg_clog
: The transaction commit log data is stored here. This data is actively read from, byVACUUM
in particular, and files are removed once there's nothing interesting in them. This directory is one of the reasons PostgreSQL doesn't work very well if you mount the database in a way that bypasses the filesystem cache. If reads and writes to the commit...