OSDN Git Service

Further cleanups for relations in schemas: teach nextval and other
[pg-rex/syncrep.git] / contrib / pgstattuple / README.pgstattuple
1 pgstattuple README                      2001/10/01 Tatsuo Ishii
2
3 1. What is pgstattuple?
4
5    pgstattuple returns the percentage of the "dead" tuples of a
6    table. This will help users to judge if vacuum is needed.
7
8    In addition, pgstattuple prints more detailed information using
9    NOTICE.
10
11 test=# select pgstattuple('tellers');
12 NOTICE:  physical length: 0.08MB live tuples: 20 (0.00MB, 1.17%) dead tuples: 320 (0.01MB, 18.75%) free/reusable space: 0.01MB (18.06%) overhead: 62.02%
13  pgstattuple 
14 -------------
15        18.75
16 (1 row)
17
18    Above example shows tellers table includes 18.75% dead tuples.
19
20    physical length      physical size of the table in MB
21    live tuples          information on the live tuples
22    dead tuples          information on the dead tuples
23    free/reusable space  available space
24    overhead             overhead space
25
26 2. Installing pgstattuple
27
28     $ make
29     $ make install
30     $ psql -e -f /usr/local/pgsql/share/contrib/pgstattuple.sql test
31
32 3. Using pgstattuple
33
34    pgstattuple can be called as a function:
35
36    pgstattuple(TEXT) RETURNS FLOAT8
37
38    The argument is the table name.  pgstattuple returns the percentage
39    of the "dead" tuples of a table.
40
41 4. Notes
42
43    pgstattuple acquires only a read lock on the table. So concurrent
44    update may affect the result.
45
46    pgstattuple judges a tuple is "dead" if HeapTupleSatisfiesNow()
47    returns false.