Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/pgvisibility.sgml`
f314d88d2a1db4306a802c899925d96bdaf098c83b619a190000000100000bd2
 boolean) returns setof record</function></term>
    <listitem>
     <para>
      Returns the all-visible and all-frozen bits in the visibility map for
      each block of the given relation.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><function>pg_visibility(relation regclass, blkno OUT bigint, all_visible OUT boolean, all_frozen OUT boolean, pd_all_visible OUT boolean) returns setof record</function></term>

    <listitem>
     <para>
      Returns the all-visible and all-frozen bits in the visibility map for
      each block of the given relation, plus the <literal>PD_ALL_VISIBLE</literal>
      bit of each block.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><function>pg_visibility_map_summary(relation regclass, all_visible OUT bigint, all_frozen OUT bigint) returns record</function></term>

    <listitem>
     <para>
      Returns the number of all-visible pages and the number of all-frozen
      pages in the relation according to the visibility map.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><function>pg_check_frozen(relation regclass, t_ctid OUT tid) returns setof tid</function></term>

    <listitem>
     <para>
      Returns the TIDs of non-frozen tuples stored in pages marked all-frozen
      in the visibility map.  If this function returns a non-empty set of
      TIDs, the visibility map is corrupt.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><function>pg_check_visible(relation regclass, t_ctid OUT tid) returns setof tid</function></term>

    <listitem>
     <para>
      Returns the TIDs of non-all-visible tuples stored in pages marked
      all-visible in the visibility map.  If this function returns a non-empty
      set of TIDs, the visibility map is corrupt.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><function>pg_truncate_visibility_map(relation regclass) returns void</function></term>

    <listitem>
     <para>
      Truncates the visibility map for the given relation.  This function is
      useful if you believe that the visibility map for the relation is
      corrupt and wish to force rebuilding it.  The first <command>VACUUM</command>
      executed on the given relation after this function is executed will scan
      every page in the relation and rebuild the visibility map.  (Until that
      is done, queries will treat the visibility map as containing all zeroes.)
     </para>
    </listitem>
   </varlistentry>
  </variablelist>

  <para>
   By default, these functions are executable only by superusers and roles with privileges
   of the <literal>pg_stat_scan_tables</literal> role, with the exception of
   <function>pg_truncate_visibility_map(relation regclass)</function> which can only
   be executed by superusers.
  </para>
 </sect2>

 <sect2 id="pgvisibility-author">
  <title>Author</title>

  <para>
   Robert Haas <email>rhaas@postgresql.org</email>
  </para>
 </sect2>

</sect1>

Title: pg_visibility Module: Functions and Permissions
Summary
This section continues describing functions in the pg_visibility module, including pg_check_frozen and pg_check_visible for detecting visibility map corruption, and pg_truncate_visibility_map for forcing visibility map rebuilding. It also details the pg_visibility_map_summary function, which provides a count of all-visible and all-frozen pages. The text concludes by explaining the default permissions for these functions, noting that most are executable by superusers and roles with pg_stat_scan_tables privileges, while pg_truncate_visibility_map is restricted to superusers only. The author of the module, Robert Haas, is credited at the end.