pg_prewarm.autoprewarm v17

Parameter type: Boolean

Default value: true

Range: {true | false}

Minimum scope of effect: Cluster

When value changes take effect: Restart

Required authorization to activate: EDB Postgres Advanced Server service account

Controls whether the database server runs autoprewarm, a background worker process that dumps shared buffers to disk before a shutdown. It then prewarms the shared buffers the next time the server is started, meaning it loads blocks from the disk back into the buffer pool.

The advantage to this parameter is that it shortens the warmup times after the server restarts by loading the data that was dumped to disk before shutdown.

Set pg_prewarm.autoprewarm to on to enable the autoprewarm worker. Set it to off to disable autoprewarm.

Before you can use autoprewarm, you must add $libdir/pg_prewarm to the libraries listed in the shared_preload_libraries configuration parameter of the postgresql.conf file, as this example shows:

shared_preload_libraries = '$libdir/dbms_pipe,$libdir/edb_gen,$libdir/dbms_aq,$libdir/pg_prewarm'

After modifying the shared_preload_libraries parameter, restart the database server. After the restart, the autoprewarm background worker launches immediately after the server reaches a consistent state.

The autoprewarm process starts loading blocks that were previously recorded in $PGDATA/autoprewarm.blocks until no free buffer space is left in the buffer pool. In this manner, any new blocks that were loaded either by the recovery process or by the querying clients aren't replaced.

Once the autoprewarm process finishes loading buffers from disk, it periodically dumps shared buffers to disk at the interval specified by the pg_prewarm.autoprewarm_interval parameter. At the next server restart, the autoprewarm process prewarms shared buffers with the blocks that were last dumped to disk.

See pg_prewarm.autoprewarm_interval for information on the autoprewarm background worker.