Parameter · Replication / Standby Servers
hot_standby
Allows connections and queries during recovery.
- Default:
on - Type: bool
- Applies: Restart required
In plain words
A standby server constantly replays the WAL it receives from the primary. With hot_standby = on (the default) you can also connect to it and run read-only queries at the same time, for reports or to offload reads. With it off, the standby still follows the primary but refuses all connections until it is promoted.
For DBAs and operators
Queries are allowed once recovery reaches a consistent state:
LOG: database system is ready to accept read-only connections
With off, connection attempts get FATAL: the database system is not accepting connections DETAIL: Hot standby mode is disabled.
Hot standby needs wal_level ≥ replica on the primary, and several settings on the standby must be ≥ the primary's: max_connections, max_prepared_transactions, max_locks_per_transaction, max_wal_senders, max_worker_processes. If the primary raises one, the standby pauses replay with WARNING: hot standby is not possible because of insufficient parameter settings and must be reconfigured and restarted.
Read queries on a standby can conflict with replay (vacuum cleanup, exclusive locks, dropped objects). See max_standby_streaming_delay and hot_standby_feedback. Check whether a server is in recovery with SELECT pg_is_in_recovery();.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then restart the server.
See it in context
Hot standby and recovery conflicts Startup process Streaming replication Server startup sequence
Related parameters
hot_standby_feedback max_standby_streaming_delay max_standby_archive_delay wal_level