postgresql/contrib/pgstattuple
Magnus Hagander 3fb50a7288 Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:17 +02:00
..
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:17 +02:00
Makefile PGXS should be set with := not =, as specified in the documentation, 2005-09-27 17:13:14 +00:00
README.pgstattuple New patch with corrected README attached. 2003-06-12 08:02:57 +00:00
README.pgstattuple.euc_jp make sure the $Id tags are converted to $PostgreSQL as well ... 2003-11-29 22:41:33 +00:00
pgstattuple.c Ensure that contrib/pgstattuple functions respond to cancel interrupts 2010-04-02 16:17:18 +00:00
pgstattuple.sql.in Remove DROPs from contrib object creation scripts, per Dave Page. 2004-10-01 15:43:40 +00:00

README.pgstattuple.euc_jp

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$PostgreSQL: pgsql/contrib/pgstattuple/README.pgstattuple.euc_jp,v 1.5 2003/11/29 22:39:29 pgsql Exp $

pgstattuple README		2002/08/22 石井達夫

1. pgstattupleとは

   pgstattupleはUPDATEやDELETEで作られたテーブルのゴミ領域の大きさを
   テーブル自体の物理的な大きさに対するパーセンテージで返却します.つ
   まり返却値が大きければそれだけゴミも多いのでvacuumをかける必
   要があるという判断の助けになるわけです.これ以外にもいろいろな情報
   が返ります.

test=# \x
Expanded display is on.
test=# select * from pgstattuple('pg_proc');
-[ RECORD 1 ]------+-------
table_len          | 458752
tuple_count        | 1470
tuple_len          | 438896
tuple_percent      | 95.67
dead_tuple_count   | 11
dead_tuple_len     | 3157
dead_tuple_percent | 0.69
free_space         | 8932
free_percent       | 1.95

各項目の説明です.

table_len		-- テーブルの物理的な大きさ(バイト)
tuple_count		-- タプル数
tuple_len		-- タプル長の合計(バイト)
tuple_percent		-- タプルの割合table_lenに対するtuple_lenの比率
dead_tuple_len		-- デッドタプル数
dead_tuple_percent	-- デッドタプルの割合table_lenに対するtuple_lenの比率
free_space		-- 再利用可能な領域(バイト)
free_percent		-- 再利用可能な領域table_lenに対するfree_spaceの比率

2. pgstattupleのインストール

   PostgreSQLが/usr/local/pgsqlにインストール済でありtestデータベー
   スにpgstattupleをインストールする場合の手順を示します

    $ make
    $ make install

    ユーザ定義関数を登録します.

    $ psql -e -f /usr/local/pgsql/share/contrib/pgstattuple.sql test


3. pgstattupleの使い方

   pgstattupleの呼び出し形式は以下です

   CREATE OR REPLACE FUNCTION pgstattuple(text) RETURNS pgstattuple_type
     AS 'MODULE_PATHNAME', 'pgstattuple'
     LANGUAGE 'c' WITH (isstrict);

   第一引数: テーブル名

   関数の戻りはpgstattuple_type型です

   pgstattupleはテーブルにAccessShareLockしかかけないので
   pgstattuple を実行中に該当テーブルに更新や削除が発生すると,正しく
   ない結果を返す可能性があります.

   pgstattupleがタプルを「ゴミ」と判断する基準は
   HeapTupleSatisfiesNow()が偽を返したときです.

4. pgstattupleのライセンス条件について

   pgstattuple.cの冒頭に書いてある通りですまたpgstattuple は完全に無保
   証ですpgstattuple を使用したことによって生じるいかなる結果に関して
   も責任を負いません.

5. 改訂履歴

   2002/09/04

	SRF変更に伴いTom Lane	が修正インターフェイスの修正を行った.
	そのことをこのREADMEにも反映

   2002/08/23

	SRF(Set Returning Function)を使って7.3用に書き換え.

   2001/12/20 Tom Laneによる修正

   	Fix pgstattuple to acquire a read lock on the target table.  This
	prevents embarassments such as having the table dropped or truncated
	partway through the scan.  Also, fix free space calculation to include
	pages that currently contain no tuples.

   2001/10/01 PostgreSQL 7.2 用contrib moduleに登録

   2001/08/30 pgstattuple バージョン 0.1リリース