in_hot_standby

A reporting configuration parameter indicating whether the server is in recovery
This entry relates to a PostgreSQL feature which is part of PostgreSQL 14, due to be released in late 2021.

in_hot_standby is a read-only reporting configuration parameter indicating whether the server is in recovery.

in_hot_standby was added in PostgreSQL 14.

Usage

in_hot_standby shows whether the server is in recovery or not; a value of on shows it is (i.e. is a standby); a value of off shows it is not (i.e. is a primary).

This information can also be retrieved via the function pg_is_in_recovery(); the primary use-case for in_hot_standby is that it is automatically reported to clients, who can retrieve the current value via the libpq function PQparameterStatus() without having to execute a query.

Change history

Examples

Basic usage with SHOW:

postgres=# SHOW in_hot_standby;
 in_hot_standby 
----------------
 on
(1 row)

postgres=# SELECT pg_promote();
 pg_promote 
------------
 t
(1 row)

postgres=# SHOW in_hot_standby;
 in_hot_standby 
----------------
 off
(1 row)

in_hot_standby can also be retrieved via the pg_settings view

postgres=# SELECT name, setting FROM pg_settings WHERE name = 'in_hot_standby';
      name      | setting 
----------------+---------
 in_hot_standby | off
(1 row)

Categories

Replication, Reporting configuration parameter

See also

hot_standby, pg_is_in_recovery()