DEV Community

Raja Rakshak
Raja Rakshak

Posted on

PostgreSQL: Chapter 01: Database Clusters, Databases and Tables

An overview of the logical and physical architecture of a PostgreSQL database cluster is given in Chapter 1 of the PostgreSQL. It addresses the following subjects:

1.1 Database Cluster Logical Structure:

PostgreSQL defines a database cluster as a group of databases controlled by a PostgreSQL server.
a justification for why a PostgreSQL server only manages a single database cluster and runs on a single host.
A database is defined as a grouping of database items, including tables, indexes, sequences, views, and functions.
It should be made clear that databases are logically distinct from one another and that they are also database objects.

1.2 The Database Cluster's Physical Structure

Introducing the base directory, the primary directory of a database cluster that houses files and subdirectories.
explanation of why the environment variable PGDATA is typically specified as the base directory.
Describes a database cluster's structure, including its folders "base," "global," and "pg_wal," as well as its files "PG_VERSION" and "postgresql.conf."
Mention is made of tablespaces, extra data locations beyond the basic directory that PostgreSQL can use.

1.2.1 A database cluster's design:
The base directory's primary files and subdirectories are listed below, including "PG_VERSION," "pg_hba.conf," "pg_ident.conf," and others.

1.2.2 Database design:
Why each database is a subdirectory under the base directory and why the database directory names correspond to the corresponding databases object identifiers (OIDs).

1.2.3 File structure related to tables and indexes:
A description of how tables and indexes are kept in their
respective database directories as separate files.
An explanation of the term "relfilenode," a variable that
controls the data file connected to a table or index.
Example showing how OIDs, relfilenodes, and data file paths are
connected.

1.2.4 Tablespaces
Tablespaces are described as additional data areas that are not
part of the basic directory.
a description of the creation of tablespaces under a given
directory and how they are connected to the "pg_tblspc"
subdirectory.
An explanation of the tablespace directory structure and how
databases and tables can be constructed inside of tablespaces.

1.3 Internal Design of a File with Heap Tables:

An overview of the fixed-length pages that make up a heap table file's internal structure.
Heap tuples (record data), line pointers (pointers to heap tuples), and header data are the three forms of data that make up a table page.

Top comments (0)