blob: 15edfb520caeebcfb7c4e7a52c5ca3c0692ca462 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
$PostgreSQL: pgsql/contrib/pgstattuple/README.pgstattuple.euc_jp,v 1.9 2007/06/07 09:56:25 mha Exp $
pgstattuple README 2002/08/22 �а�ã��
1. ���ݡ��Ȥ���Ƥ���ؿ�
pgstattuple
-----------
pgstattuple�ϡ�UPDATE��DELETE�Ǻ��줿��졼�����Υ����ΰ���礭����
��졼������Τ�ʪ��Ū���礭�����Ф���ѡ�����ơ������ֵѤ��ޤ�����
�ޤꡤ�ֵ��ͤ��礭����С�����������ߤ�¿���Τǡ�vacuum����ɬ
�פ�����Ȥ���Ƚ�Ǥν����ˤʤ�櫓�Ǥ�������ʳ��ˤ⤤�������ʾ���
���֤�ޤ���
pgstattuple() �ϡ���졼������Ĺ���䡢���ץ��"�����ΰ�"�γ��ʤɤ�
������ֵѤ��ޤ��������ξ���ϡ�vacuum ��ɬ�פ��ɤ������桼����Ƚ��
����Τ���Ω�ĤǤ��礦���㤨�аʲ��Τ褦�ʷ��ˤʤ�ޤ���
test=> \x
Expanded display is on.
test=> SELECT * FROM pgstattuple('pg_catalog.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����Ψ��
pg_relpages
-----------
pg_relpages() �ϥ�졼�����Υڡ��������ֵѤ��ޤ���
pgstatindex
-----------
pgstatindex() �ϥ���ǥå����˴ؤ��������ֵѤ��ޤ���
test=> \x
Expanded display is on.
test=> SELECT * FROM pgstatindex('pg_cast_oid_index');
-[ RECORD 1 ]------+------
version | 2
tree_level | 0
index_size | 8192
root_block_no | 1
internal_pages | 0
leaf_pages | 1
empty_pages | 0
deleted_pages | 0
avg_leaf_density | 50.27
leaf_fragmentation | 0
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 STRICT;
������: ��졼�����̾
�ؿ�������pgstattuple_type���Ǥ���
pgstattuple�ϥ�졼������AccessShareLock���������ʤ��Τǡ�
pgstattuple ��¹���˳�����졼�����˹���������ȯ������ȡ�������
�ʤ���̤��֤���ǽ��������ޤ���
pgstattuple�����ץ��֥��ߡפ�Ƚ�Ǥ�����ϡ�
HeapTupleSatisfiesNow()�������֤����Ȥ��Ǥ���
4. pgstattuple�Υ饤�����ˤĤ���
pgstattuple.c����Ƭ�˽Ƥ����̤�Ǥ����ޤ���pgstattuple �ϴ�����̵��
�ڤǤ���pgstattuple ����Ѥ������Ȥˤ�ä������뤤���ʤ��̤˴ؤ���
����Ǥ���餤�ޤ���
5. ��������
2006/06/28
����ǥå������Ф��Ƥ�ư���褦�˳�ĥ��
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����
|