Home Explore Blog CI



postgresql

7th chunk of `doc/src/sgml/pgstattuple.sgml`
42b2154f1b7e249dc378798a8423db203588bc6f05ccba140000000100000c50
 tuple, recording its
      presence and size in the appropriate counters, and adding up the
      free space on the page. At the end, it estimates the total number of
      live tuples based on the number of pages and tuples scanned (in the
      same way that VACUUM estimates pg_class.reltuples).
     </para>

     <table id="pgstatapprox-columns">
      <title><function>pgstattuple_approx</function> Output Columns</title>
      <tgroup cols="3">
       <thead>
        <row>
         <entry>Column</entry>
         <entry>Type</entry>
         <entry>Description</entry>
        </row>
       </thead>

       <tbody>
        <row>
         <entry><structfield>table_len</structfield></entry>
         <entry><type>bigint</type></entry>
         <entry>Physical relation length in bytes (exact)</entry>
        </row>
        <row>
         <entry><structfield>scanned_percent</structfield></entry>
         <entry><type>float8</type></entry>
         <entry>Percentage of table scanned</entry>
        </row>
        <row>
         <entry><structfield>approx_tuple_count</structfield></entry>
         <entry><type>bigint</type></entry>
         <entry>Number of live tuples (estimated)</entry>
        </row>
        <row>
         <entry><structfield>approx_tuple_len</structfield></entry>
         <entry><type>bigint</type></entry>
         <entry>Total length of live tuples in bytes (estimated)</entry>
        </row>
        <row>
         <entry><structfield>approx_tuple_percent</structfield></entry>
         <entry><type>float8</type></entry>
         <entry>Percentage of live tuples</entry>
        </row>
        <row>
         <entry><structfield>dead_tuple_count</structfield></entry>
         <entry><type>bigint</type></entry>
         <entry>Number of dead tuples (exact)</entry>
        </row>
        <row>
         <entry><structfield>dead_tuple_len</structfield></entry>
         <entry><type>bigint</type></entry>
         <entry>Total length of dead tuples in bytes (exact)</entry>
        </row>
        <row>
         <entry><structfield>dead_tuple_percent</structfield></entry>
         <entry><type>float8</type></entry>
         <entry>Percentage of dead tuples</entry>
        </row>
        <row>
         <entry><structfield>approx_free_space</structfield></entry>
         <entry><type>bigint</type></entry>
         <entry>Total free space in bytes (estimated)</entry>
        </row>
        <row>
         <entry><structfield>approx_free_percent</structfield></entry>
         <entry><type>float8</type></entry>
         <entry>Percentage of free space</entry>
        </row>

       </tbody>
      </tgroup>
     </table>

     <para>
      In the above output, the free space figures may not match the
      <function>pgstattuple</function> output exactly, because the free
      space map gives us an exact figure, but is not guaranteed to be
      accurate to the byte.
     </para>

    </listitem>
   </varlistentry>

  </variablelist>
 </sect2>

 <sect2 id="pgstattuple-authors">
  <title>Authors</title>

  <para>
   Tatsuo Ishii, Satoshi Nagayasu and Abhijit Menon-Sen
  </para>
 </sect2>

</sect1>

Title: pgstattuple_approx: Tuple Estimation, Output Columns, and Authorship
Summary
The pgstattuple_approx function estimates live tuples based on scanned pages, similar to VACUUM's estimation of pg_class.reltuples. The output columns, including details about table length, scanned percentage, approximate and exact tuple counts/lengths/percentages, and approximate free space, are described. The free space figures may not perfectly match pgstattuple due to the free space map's accuracy. The extension was authored by Tatsuo Ishii, Satoshi Nagayasu, and Abhijit Menon-Sen.