Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 9b6cc37ce608401d44f6535a0c7cb777 > files > 556

postgresql11-docs-11.5-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>F.27. pg_prewarm</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="pgfreespacemap.html" title="F.26. pg_freespacemap" /><link rel="next" href="pgrowlocks.html" title="F.28. pgrowlocks" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.27. pg_prewarm</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="pgfreespacemap.html" title="F.26. pg_freespacemap">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 11.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="pgrowlocks.html" title="F.28. pgrowlocks">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="PGPREWARM"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.27. pg_prewarm</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="pgprewarm.html#id-1.11.7.36.4">F.27.1. Functions</a></span></dt><dt><span class="sect2"><a href="pgprewarm.html#id-1.11.7.36.5">F.27.2. Configuration Parameters</a></span></dt><dt><span class="sect2"><a href="pgprewarm.html#id-1.11.7.36.6">F.27.3. Author</a></span></dt></dl></div><a id="id-1.11.7.36.2" class="indexterm"></a><p>
  The <code class="filename">pg_prewarm</code> module provides a convenient way
  to load relation data into either the operating system buffer cache
  or the <span class="productname">PostgreSQL</span> buffer cache.  Prewarming
  can be performed manually using the <code class="filename">pg_prewarm</code> function,
  or can be performed automatically by including <code class="literal">pg_prewarm</code> in
  <a class="xref" href="runtime-config-client.html#GUC-SHARED-PRELOAD-LIBRARIES">shared_preload_libraries</a>.  In the latter case, the
  system will run a background worker which periodically records the contents
  of shared buffers in a file called <code class="filename">autoprewarm.blocks</code> and
  will, using 2 background workers, reload those same blocks after a restart.
 </p><div class="sect2" id="id-1.11.7.36.4"><div class="titlepage"><div><div><h3 class="title">F.27.1. Functions</h3></div></div></div><pre class="synopsis">
pg_prewarm(regclass, mode text default 'buffer', fork text default 'main',
           first_block int8 default null,
           last_block int8 default null) RETURNS int8
</pre><p>
   The first argument is the relation to be prewarmed.  The second argument
   is the prewarming method to be used, as further discussed below; the third
   is the relation fork to be prewarmed, usually <code class="literal">main</code>.
   The fourth argument is the first block number to prewarm
   (<code class="literal">NULL</code> is accepted as a synonym for zero).  The fifth
   argument is the last block number to prewarm (<code class="literal">NULL</code>
   means prewarm through the last block in the relation).  The return value
   is the number of blocks prewarmed.
  </p><p>
   There are three available prewarming methods.  <code class="literal">prefetch</code>
   issues asynchronous prefetch requests to the operating system, if this is
   supported, or throws an error otherwise.  <code class="literal">read</code> reads
   the requested range of blocks; unlike <code class="literal">prefetch</code>, this is
   synchronous and supported on all platforms and builds, but may be slower.
   <code class="literal">buffer</code> reads the requested range of blocks into the
   database buffer cache.
  </p><p>
   Note that with any of these methods, attempting to prewarm more blocks than
   can be cached — by the OS when using <code class="literal">prefetch</code> or
   <code class="literal">read</code>, or by <span class="productname">PostgreSQL</span> when
   using <code class="literal">buffer</code> — will likely result in lower-numbered
   blocks being evicted as higher numbered blocks are read in.  Prewarmed data
   also enjoys no special protection from cache evictions, so it is possible
   that other system activity may evict the newly prewarmed blocks shortly
   after they are read; conversely, prewarming may also evict other data from
   cache. For these reasons, prewarming is typically most useful at startup,
   when caches are largely empty.
  </p><pre class="synopsis">
autoprewarm_start_worker() RETURNS void
</pre><p>
   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.
  </p><pre class="synopsis">
autoprewarm_dump_now() RETURNS int8
</pre><p>
   Update <code class="filename">autoprewarm.blocks</code> 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 <code class="filename">autoprewarm.blocks</code>.
  </p></div><div class="sect2" id="id-1.11.7.36.5"><div class="titlepage"><div><div><h3 class="title">F.27.2. Configuration Parameters</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
     <code class="varname">pg_prewarm.autoprewarm</code> (<code class="type">boolean</code>)
     <a id="id-1.11.7.36.5.2.1.1.3" class="indexterm"></a>
    </span></dt><dd><p>
      Controls whether the server should run the autoprewarm worker. This is
      on by default. This parameter can only be set at server start.
     </p></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
     <code class="varname">pg_prewarm.autoprewarm_interval</code> (<code class="type">int</code>)
     <a id="id-1.11.7.36.5.3.1.1.3" class="indexterm"></a>
    </span></dt><dd><p>
      This is the interval between updates to <code class="literal">autoprewarm.blocks</code>.
      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.
     </p></dd></dl></div></div><div class="sect2" id="id-1.11.7.36.6"><div class="titlepage"><div><div><h3 class="title">F.27.3. Author</h3></div></div></div><p>
   Robert Haas <code class="email">&lt;<a class="email" href="mailto:rhaas@postgresql.org">rhaas@postgresql.org</a>&gt;</code>
  </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pgfreespacemap.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pgrowlocks.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.26. pg_freespacemap </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> F.28. pgrowlocks</td></tr></table></div></body></html>