Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
pgfreespacemap.html68 linesDownload Raw Back to html
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!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.29. pg_freespacemap — examine the free space map</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="pgcrypto.html" title="F.28. pgcrypto — cryptographic functions" /><link rel="next" href="pgprewarm.html" title="F.30. pg_prewarm — preload relation data into buffer caches" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.29. pg_freespacemap — examine the free space map</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="pgcrypto.html" title="F.28. pgcrypto — cryptographic functions">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules and Extensions</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="pgprewarm.html" title="F.30. pg_prewarm — preload relation data into buffer caches">Next</a></td></tr></table><hr /></div><div class="sect1" id="PGFREESPACEMAP"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.29. pg_freespacemap — examine the free space map <a href="#PGFREESPACEMAP" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="pgfreespacemap.html#PGFREESPACEMAP-FUNCS">F.29.1. Functions</a></span></dt><dt><span class="sect2"><a href="pgfreespacemap.html#PGFREESPACEMAP-SAMPLE-OUTPUT">F.29.2. Sample Output</a></span></dt><dt><span class="sect2"><a href="pgfreespacemap.html#PGFREESPACEMAP-AUTHOR">F.29.3. Author</a></span></dt></dl></div><a id="id-1.11.7.39.2" class="indexterm"></a><p>3  The <code class="filename">pg_freespacemap</code> module provides a means for examining the4  <a class="link" href="storage-fsm.html" title="73.3. Free Space Map">free space map</a> (<acronym class="acronym">FSM</acronym>).5  It provides a function called <code class="function">pg_freespace</code>, or two6  overloaded functions, to be precise. The functions show the value recorded in7  the free space map for a given page, or for all pages in the relation.8 </p><p>9  By default use is restricted to superusers and roles with privileges of the10  <code class="literal">pg_stat_scan_tables</code> role. Access may be granted to others11  using <code class="command">GRANT</code>.12 </p><div class="sect2" id="PGFREESPACEMAP-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.29.1. Functions <a href="#PGFREESPACEMAP-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">13     <code class="function">pg_freespace(rel regclass IN, blkno bigint IN) returns int2</code>14     <a id="id-1.11.7.39.5.2.1.1.2" class="indexterm"></a>15    </span></dt><dd><p>16      Returns the amount of free space on the page of the relation, specified17      by <code class="literal">blkno</code>, according to the <acronym class="acronym">FSM</acronym>.18     </p></dd><dt><span class="term">19     <code class="function">pg_freespace(rel regclass IN, blkno OUT bigint, avail OUT int2)</code>20    </span></dt><dd><p>21      Displays the amount of free space on each page of the relation,22      according to the <acronym class="acronym">FSM</acronym>. A set of23      <code class="literal">(blkno bigint, avail int2)</code>24      tuples is returned, one tuple for each page in the relation.25     </p></dd></dl></div><p>26   The values stored in the free space map are not exact. They're rounded27   to precision of 1/256th of <code class="symbol">BLCKSZ</code> (32 bytes with default <code class="symbol">BLCKSZ</code>), and28   they're not kept fully up-to-date as tuples are inserted and updated.29  </p><p>30   For indexes, what is tracked is entirely-unused pages, rather than free31   space within pages.  Therefore, the values are not meaningful, just32   whether a page is full or empty.33  </p></div><div class="sect2" id="PGFREESPACEMAP-SAMPLE-OUTPUT"><div class="titlepage"><div><div><h3 class="title">F.29.2. Sample Output <a href="#PGFREESPACEMAP-SAMPLE-OUTPUT" class="id_link">#</a></h3></div></div></div><pre class="screen">34postgres=# SELECT * FROM pg_freespace('foo');35 blkno | avail36-------+-------37     0 |     038     1 |     039     2 |     040     3 |    3241     4 |   70442     5 |   70443     6 |   70444     7 |  121645     8 |   70446     9 |   70447    10 |   70448    11 |   70449    12 |   70450    13 |   70451    14 |   70452    15 |   70453    16 |   70454    17 |   70455    18 |   70456    19 |  364857(20 rows)58 59postgres=# SELECT * FROM pg_freespace('foo', 7);60 pg_freespace61--------------62         121663(1 row)64</pre></div><div class="sect2" id="PGFREESPACEMAP-AUTHOR"><div class="titlepage"><div><div><h3 class="title">F.29.3. Author <a href="#PGFREESPACEMAP-AUTHOR" class="id_link">#</a></h3></div></div></div><p>65   Original version by Mark Kirkwood <code class="email">&lt;<a class="email" href="mailto:markir@paradise.net.nz">markir@paradise.net.nz</a>&gt;</code>.66   Rewritten in version 8.4 to suit new <acronym class="acronym">FSM</acronym> implementation67   by Heikki Linnakangas <code class="email">&lt;<a class="email" href="mailto:heikki@enterprisedb.com">heikki@enterprisedb.com</a>&gt;</code>68  </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pgcrypto.html" title="F.28. pgcrypto — cryptographic functions">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pgprewarm.html" title="F.30. pg_prewarm — preload relation data into buffer caches">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.28. pgcrypto — cryptographic functions </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.30. pg_prewarm — preload relation data into buffer caches</td></tr></table></div></body></html>
codekingpro/portable-devtools · Team Ai