pg_prewarm.autoprewarm v14

Parameter type: Boolean

Default value: true

Range: {true | false}

Minimum scope of effect: Cluster

When value changes take effect: Restart

Required authorization to activate: EPAS service account

This parameter controls whether or not the database server should run autoprewarm, which is a background worker process that automatically 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 is that it shortens the warm up times after the server has been restarted by loading the data that has been dumped to disk before shutdown.

If pg_prewarm.autoprewarm is set to on, the autoprewarm worker is enabled. If the parameter is set to off, autoprewarm is disabled. The parameter is on by default.

Before autoprewarm can be used, you must add $libdir/pg_prewarm to the libraries listed in the shared_preload_libraries configuration parameter of the postgresql.conf file as shown by the following example:

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 which the autoprewarm background worker is launched immediately after the server has reached a consistent state.

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

Once the autoprewarm process has finished loading buffers from disk, it periodically dumps shared buffers to disk at the interval specified by the pg_prewarm.autoprewarm_interval parameter. See the pg_prewarm.autoprewarm_interval for information on the autoprewarm background worker. Upon the next server restart, the autoprewarm process prewarms shared buffers with the blocks that were last dumped to disk.