DEV Community

Cover image for Database Cluster Layout

Posted on

Database Cluster Layout

In this post, we will discuss the Cluster Database Layout of PostgreSQL.

The layout of database cluster has been shown below. Main files and subdirectories in a part of the document have been listed here:
Database Cluster Layout
In here, demo is a database cluster. Under the Database Cluster it has 6 files which are:

  1. pg_hba.conf: Used for PosgreSQL's client authentication.
  2. pg_ident.conf: Used for controlling PostgreSQL's user name mapping
  3. PG_VERSION: Containing version number of PostgreSQL
  4. postgresql.conf: Used for settin configuration parameters
  5. In ALTER SYSTEM, it is stored configuration parameters.
  6. postmaster.opts: Record the last command line options for the server.

In here, demo has 17 directories which are:

  1. base: Subdirectory containing per-database subdirectories. A database is a subdirectory under the base subdirectory; and the database directory names are identical to the respective OIDs. For example, when the OID of the database is 16384, its subdirectory name is 16384. base
  2. global: It contains cluster-wide tables, such as pg_database and pg_control.
  3. pg_commit_ts: Subdirectory containing transaction commit timestamp data. Version 9.5 or later.
  4. pg_dynshmem:Subdirectory containing files used by the dynamic shared memory subsystem. Version 9.4 or later.
  5. pg_logical:Subdirectory containing status data for logical decoding. Version 9.4 or later.
  6. pg_multixact:Subdirectory containing multitransaction status data (used for shared row locks)
  7. pg_notify:Subdirectory containing LISTEN/NOTIFY status data
  8. pg_replslot:Subdirectory containing replication slot data. Version 9.4 or later.
  9. pg_serial:Subdirectory containing information about committed serializable transactions (version 9.1 or later)
  10. pg_snapshots:Subdirectory containing exported snapshots (version 9.2 or later). The PostgreSQL's function pg_export_snapshot creates a snapshot information file in this subdirectory.
  11. pg_stat:Subdirectory containing permanent files for the statistics subsystem.
  12. pg_stat_tmp:Subdirectory containing temporary files for the statistics subsystem.
  13. pg_subtrans: Containing subtransaction status data
  14. pg_tblspc: Containing symbolic links to tablespaces
  15. pg_twophase: Containing state files for prepared transactions
  16. pg_wal: Containing WAL (Write Ahead Logging) segment files. It is renamed from pg_xlog in Version 10.
  17. pg_xact: Containing transaction commit state data. It is renamed from pg_clog in Version 10.

✔️ References:


Top comments (0)