diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-08-21 14:43:00 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-08-21 14:17:39 -0400 |
commit | 79ccd7cbd5ca44bee0191d12e9e65abf702899e7 (patch) | |
tree | 61870b5ef1e67989c29ab070c11378e8522330c9 /doc/src | |
parent | 66ed3829df959adb47f71d7c903ac59f0670f3e1 (diff) |
pg_prewarm: Add automatic prewarm feature.
Periodically while the server is running, and at shutdown, write out a
list of blocks in shared buffers. When the server reaches consistency
-- unfortunatey, we can't do it before that point without breaking
things -- reload those blocks into any still-unused shared buffers.
Mithun Cy and Robert Haas, reviewed and tested by Beena Emerson,
Amit Kapila, Jim Nasby, and Rafia Sabih.
Discussion: http://postgr.es/m/CAD__OugubOs1Vy7kgF6xTjmEqTR4CrGAv8w+ZbaY_+MZeitukw@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/pgprewarm.sgml | 69 |
1 files changed, 68 insertions, 1 deletions
diff --git a/doc/src/sgml/pgprewarm.sgml b/doc/src/sgml/pgprewarm.sgml index c090401eca6..c6b94a8b728 100644 --- a/doc/src/sgml/pgprewarm.sgml +++ b/doc/src/sgml/pgprewarm.sgml @@ -10,7 +10,13 @@ <para> The <filename>pg_prewarm</filename> module provides a convenient way to load relation data into either the operating system buffer cache - or the <productname>PostgreSQL</productname> buffer cache. + or the <productname>PostgreSQL</productname> buffer cache. Prewarming + can be performed manually using the <filename>pg_prewarm</> function, + or can be performed automatically by including <literal>pg_prewarm</> in + <xref linkend="guc-shared-preload-libraries">. In the latter case, the + system will run a background worker which periodically records the contents + of shared buffers in a file called <filename>autoprewarm.blocks</> and + will, using 2 background workers, reload those same blocks after a restart. </para> <sect2> @@ -55,6 +61,67 @@ pg_prewarm(regclass, mode text default 'buffer', fork text default 'main', cache. For these reasons, prewarming is typically most useful at startup, when caches are largely empty. </para> + +<synopsis> +autoprewarm_start_worker() RETURNS void +</synopsis> + + <para> + Launch the main autoprewarm worker. This will normally happen + automatically, but is useful if automatic prewarm was not configured at + server startup time and you wish to start up the worker at a later time. + </para> + +<synopsis> +autoprewarm_dump_now() RETURNS int8 +</synopsis> + + <para> + Update <filename>autoprewarm.blocks</> immediately. This may be useful + if the autoprewarm worker is not running but you anticipate running it + after the next restart. The return value is the number of records written + to <filename>autoprewarm.blocks</>. + </para> + </sect2> + + <sect2> + <title>Configuration Parameters</title> + + <variablelist> + <varlistentry> + <term> + <varname>pg_prewarm.autoprewarm</varname> (<type>boolean</type>) + <indexterm> + <primary><varname>pg_prewarm.autoprewarm</> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Controls whether the server should run the autoprewarm worker. This is + on by default. This parameter can only be set at server start. + </para> + </listitem> + </varlistentry> + </variablelist> + + <variablelist> + <varlistentry> + <term> + <varname>pg_prewarm.autoprewarm_interval</varname> (<type>int</type>) + <indexterm> + <primary><varname>pg_prewarm.autoprewarm_interval</> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + This is the interval between updates to <literal>autoprewarm.blocks</>. + The default is 300 seconds. If set to 0, the file will not be + dumped at regular intervals, but only when the server is shut down. + </para> + </listitem> + </varlistentry> + </variablelist> + </sect2> <sect2> |