2. Concepts

PostgreSQL is a relational database management system (RDBMS). That means it is a system for managing data stored in relations. Relation is essentially a mathematical term for table. The notion of storing data in tables is so commonplace today that it might seem inherently obvious, but there are a number of other ways of organizing databases. Files and directories on Unix-like operating systems form an example of a hierarchical database. A more modern development is the object-oriented database

Internals//Physical Storage: Visibility Map

Each heap relation has a Visibility Map (VM) to keep track of which pages contain only tuples that are known to be visible to all active transactions; it also keeps track of which pages contain only unfrozen tuples. It's stored alongside the main relation data in a separate relation fork, named after the filenode number of the relation, plus a _vm suffix. For example, if the filenode of a relation is 12345, the VM is stored in a file called 12345_vm, in the same directory as the main relation f

Internals//Physical Storage: Free Space Map

Each heap and index relation, except for hash indexes, has a Free Space Map (FSM) to keep track of available space in the relation. It's stored alongside the main relation data in a separate relation fork, named after the filenode number of the relation, plus a _fsm suffix. For example, if the filenode of a relation is 12345, the FSM is stored in a file called 12345_fsm, in the same directory as the main relation file. The Free Space Map is organized as a tree of FSM pages. The bottom level FSM

Catalogs: pg_available_extensions

The pg_available_extensions view lists the extensions that are available for installation. See also the pg_extension catalog, which shows the extensions currently installed. Table 50-59. pg_available_extensions Columns Name Type Description name name Extension name default_version text Name of default version, or NULL if none is specified installed_version text Currently installed version of the extension, or NULL if not installed comment text Comment string from the extension's control file

Catalogs: pg_enum

The pg_enum catalog contains entries showing the values and labels for each enum type. The internal representation of a given enum value is actually the OID of its associated row in pg_enum. Table 50-20. pg_enum Columns Name Type References Description oid oid Row identifier (hidden attribute; must be explicitly selected) enumtypid oid pg_type.oid The OID of the pg_type entry owning this enum value enumsortorder float4 The sort position of this enum value within its enum type enumlabel na

CREATE USER

NameCREATE USER -- define a new database role Synopsis CREATE USER name [ [ WITH ] option [ ... ] ] where option can be: SUPERUSER | NOSUPERUSER | CREATEDB | NOCREATEDB | CREATEROLE | NOCREATEROLE | INHERIT | NOINHERIT | LOGIN | NOLOGIN | REPLICATION | NOREPLICATION | BYPASSRLS | NOBYPASSRLS | CONNECTION LIMIT connlimit | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password' | VALID UNTIL 'timestamp' | IN ROLE role_name [, ...] | IN GROUP role

pg_visibility

The pg_visibility module provides a means for examining the visibility map (VM) and page-level visibility information. It also provides functions to check the integrity of the visibility map and to force it to be rebuilt. Three different bits are used to store information about page-level visibility. The all-visible bit in the visibility map indicates that every tuple on a given page of a relation is visible to every current transaction. The all-frozen bit in the visibility map indicates that e

WAL Configuration

There are several WAL-related configuration parameters that affect database performance. This section explains their use. Consult Chapter 19 for general information about setting server configuration parameters. Checkpoints are points in the sequence of transactions at which it is guaranteed that the heap and index data files have been updated with all information written before that checkpoint. At checkpoint time, all dirty data pages are flushed to disk and a special checkpoint record is writ

Array Comparisons

This section describes several specialized constructs for making multiple comparisons between groups of values. These forms are syntactically related to the subquery forms of the previous section, but do not involve subqueries. The forms involving array subexpressions are PostgreSQL extensions; the rest are SQL-compliant. All of the expression forms documented in this section return Boolean (true/false) results. 9.23.1. IN expression IN (value [, ...]) The right-hand side is a parenthesized

Managing Kernel Resources

PostgreSQL can sometimes exhaust various operating system resource limits, especially when multiple copies of the server are running on the same system, or in very large installations. This section explains the kernel resources used by PostgreSQL and the steps you can take to resolve problems related to kernel resource consumption. 18.4.1. Shared Memory and Semaphores Shared memory and semaphores are collectively referred to as "System V IPC" (together with message queues, which are not releva