Postgresql - pg_default, pg_global tablespaces

The two preset tablespaces in PostgreSQL with different functions are pg_default and pg_global:
1. Tablespace pg_default
  • Goal: When no other tablespace is specifically defined for a database item (such as tables or indexes), the PostgreSQL database system uses the pg_default tablespace by default.
  • Usage: Unless instructed differently, the majority of user-created items and system catalogs are kept in pg_default. The PostgreSQL instance's data directory contains this tablespace.
  • Features: The primary data directory and it share the same storage space. Perfect for database items and general-purpose storage that don't require particular storage considerations.

    2. pg_global Tablespace
  • Goal: Shared global system catalogs are stored in the pg_global tablespace. This contains items like system-wide catalogs (pg_database, pg_authid, etc.) that are shared throughout the PostgreSQL cluster.
  • Use: The metadata included in database objects stored in pg_global is available to all databases in the cluster and is not unique to any one database.
  • Features: It is not applicable to ordinary user data or objects and plays a special role for global objects. Guarantees the cluster's consistent availability of shared system information.

    (Postgresql - Create, Modify tablespace)