バージョンごとのドキュメント一覧

F.29. pg_freespacemap — 空き領域マップを検査する #

<title>pg_freespacemap &mdash; examine the free space map</title>

The <filename>pg_freespacemap</filename> module provides a means for examining the <link linkend="storage-fsm">free space map</link> (<acronym>FSM</acronym>). It provides a function called <function>pg_freespace</function>, or two overloaded functions, to be precise. The functions show the value recorded in the free space map for a given page, or for all pages in the relation. pg_freespacemapモジュールは、空き領域マップFSM)を検査する手法を提供します。 pg_freespaceと呼ばれる関数、正確に言うと、二つの多重定義された関数を提供します。 これらの関数は、指定されたページ、あるいはリレーションのすべてのページについての、空き領域マップに記録されている値を表示します。

By default use is restricted to superusers and roles with privileges of the <literal>pg_stat_scan_tables</literal> role. Access may be granted to others using <command>GRANT</command>. デフォルトでは、使用はスーパーユーザとpg_stat_scan_tablesロールの権限を持つロールに限定されています。 GRANTを使って他人にアクセス権を付与できます。

F.29.1. 関数 #

<title>Functions</title>
pg_freespace(rel regclass IN, blkno bigint IN) returns int2

Returns the amount of free space on the page of the relation, specified by <literal>blkno</literal>, according to the <acronym>FSM</acronym>. FSMを参照して、blknoで指定されたリレーションのページ上の空き領域のサイズを返します。

pg_freespace(rel regclass IN, blkno OUT bigint, avail OUT int2)

Displays the amount of free space on each page of the relation, according to the <acronym>FSM</acronym>. A set of <literal>(blkno bigint, avail int2)</literal> tuples is returned, one tuple for each page in the relation. FSMを参照して、リレーションの各ページの空き領域のサイズを表示します。 リレーションの各ページに対して(blkno bigint, avail int2)が1タプルとなり、これらのタプルのセットが返却されます。

The values stored in the free space map are not exact. They're rounded to precision of 1/256th of <symbol>BLCKSZ</symbol> (32 bytes with default <symbol>BLCKSZ</symbol>), and they're not kept fully up-to-date as tuples are inserted and updated. 空き領域マップに格納された値は、正確ではありません。 これらの値はBLCKSZの1/256(デフォルトBLCKSZでは32バイト)の精度で丸められ、また、タプルが挿入や更新されるのと同時に完全に最新に保たれているというわけではありません。

For indexes, what is tracked is entirely-unused pages, rather than free space within pages. Therefore, the values are not meaningful, just whether a page is full or empty. インデックスでは、ページ内の空き領域ではなく、完全に未使用のページが追跡されます。 したがって、その値には意味がなく、単にページが一杯か空かを表します。

F.29.2. サンプル出力 #

<title>Sample Output</title>
postgres=# SELECT * FROM pg_freespace('foo');
 blkno | avail
-------+-------
     0 |     0
     1 |     0
     2 |     0
     3 |    32
     4 |   704
     5 |   704
     6 |   704
     7 |  1216
     8 |   704
     9 |   704
    10 |   704
    11 |   704
    12 |   704
    13 |   704
    14 |   704
    15 |   704
    16 |   704
    17 |   704
    18 |   704
    19 |  3648
(20 rows)

postgres=# SELECT * FROM pg_freespace('foo', 7);
 pg_freespace
--------------
         1216
(1 row)

F.29.3. 作者 #

<title>Author</title>

Original version by Mark Kirkwood <email>markir@paradise.net.nz</email>. Rewritten in version 8.4 to suit new <acronym>FSM</acronym> implementation by Heikki Linnakangas <email>heikki@enterprisedb.com</email> オリジナルバージョンは Mark Kirkwood によるものです。 バージョン8.4では、Heikki Linnakangas により、新しいFSM実装に合うよう書き直されました。