pg_stat_statements

The pg_stat_statements module provides a means for tracking execution statistics of all SQL statements executed by a server. The module must be loaded by adding pg_stat_statements to shared_preload_libraries in postgresql.conf, because it requires additional shared memory. This means that a server restart is needed to add or remove the module. When pg_stat_statements is loaded, it tracks statistics across all databases of the server. To access and manipulate these statistics, the module provide

pg_rewind

Namepg_rewind -- synchronize a PostgreSQL data directory with another data directory that was forked from it Synopsis pg_rewind [option...] {-D | --target-pgdata} directory {--source-pgdata=directory | --source-server=connstr} Description pg_rewind is a tool for synchronizing a PostgreSQL cluster with another copy of the same cluster, after the clusters' timelines have diverged. A typical scenario is to bring an old master server back online after failover as a standby that follows the

pg_restore

Namepg_restore -- restore a PostgreSQL database from an archive file created by pg_dump Synopsis pg_restore [connection-option...] [option...] [filename] Description pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats. It will issue the commands necessary to reconstruct the database to the state it was in at the time it was saved. The archive files also allow pg_restore to be selective about what is restored

pg_resetxlog

Namepg_resetxlog -- reset the write-ahead log and other control information of a PostgreSQL database cluster Synopsis pg_resetxlog [-f] [-n] [option...] {[-D] datadir} Description pg_resetxlog clears the write-ahead log (WAL) and optionally resets some other control information stored in the pg_control file. This function is sometimes needed if these files have become corrupted. It should be used only as a last resort, when the server will not start due to such corruption. After running

pg_recvlogical

Namepg_recvlogical -- control PostgreSQL logical decoding streams Synopsis pg_recvlogical [option...] Description pg_recvlogical controls logical decoding replication slots and streams data from such replication slots. It creates a replication-mode connection, so it is subject to the same constraints as pg_receivexlog, plus those for logical replication (see Chapter 47). Options At least one of the following options must be specified to select an action: --create-slot Create a new

pg_receivexlog

Namepg_receivexlog -- stream transaction logs from a PostgreSQL server Synopsis pg_receivexlog [option...] Description pg_receivexlog is used to stream the transaction log from a running PostgreSQL cluster. The transaction log is streamed using the streaming replication protocol, and is written to a local directory of files. This directory can be used as the archive location for doing a restore using point-in-time recovery (see Section 25.3). pg_receivexlog streams the transaction log i

pg_prewarm

The pg_prewarm module provides a convenient way to load relation data into either the operating system buffer cache or the PostgreSQL buffer cache. F.27.1. Functions pg_prewarm(regclass, mode text default 'buffer', fork text default 'main', first_block int8 default null, last_block int8 default null) RETURNS int8 The first argument is the relation to be prewarmed. The second argument is the prewarming method to be used, as further discussed below; the third is the relat

pg_lsn Type

The pg_lsn data type can be used to store LSN (Log Sequence Number) data which is a pointer to a location in the XLOG. This type is a representation of XLogRecPtr and an internal system type of PostgreSQL. Internally, an LSN is a 64-bit integer, representing a byte position in the write-ahead log stream. It is printed as two hexadecimal numbers of up to 8 digits each, separated by a slash; for example, 16/B374D848. The pg_lsn type supports the standard comparison operators, like = and >. Two

pg_isready

Namepg_isready -- check the connection status of a PostgreSQL server Synopsis pg_isready [connection-option...] [option...] Description pg_isready is a utility for checking the connection status of a PostgreSQL database server. The exit status specifies the result of the connection check. Options -d dbname--dbname=dbname Specifies the name of the database to connect to. If this parameter contains an = sign or starts with a valid URI prefix (postgresql:// or postgres://), it is tr

pg_hba.conf File

Client authentication is controlled by a configuration file, which traditionally is named pg_hba.conf and is stored in the database cluster's data directory. (HBA stands for host-based authentication.) A default pg_hba.conf file is installed when the data directory is initialized by initdb. It is possible to place the authentication configuration file elsewhere, however; see the hba_file configuration parameter. The general format of the pg_hba.conf file is a set of records, one per line. Blank