Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2d237c7

Browse files
committed
Move disk usage section into its own section.
1 parent5612949 commit2d237c7

File tree

4 files changed

+112
-97
lines changed

4 files changed

+112
-97
lines changed

‎doc/src/sgml/admin.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/admin.sgml,v 1.36 2001/10/16 23:57:06 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/admin.sgml,v 1.37 2002/06/13 05:15:22 momjian Exp $
33
-->
44

55
<book id="admin">
@@ -32,8 +32,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/admin.sgml,v 1.36 2001/10/16 23:57:06
3232
&maintenance;
3333
&backup;
3434
&monitoring;
35+
&diskusage;
3536
&wal;
36-
&storage;
3737
&recovery;
3838
&regress;
3939
&release;

‎doc/src/sgml/diskusage.sgml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<!--
2+
$Header: /cvsroot/pgsql/doc/src/sgml/diskusage.sgml,v 1.1 2002/06/13 05:15:22 momjian Exp $
3+
-->
4+
5+
<chapter id="diskusage">
6+
<title>Monitoring Disk Usage</title>
7+
8+
<sect1 id="disk-usage">
9+
<title>Monitoring Disk Usage</Title>
10+
11+
<indexterm zone="disk-usage">
12+
<primary>disk usage</primary>
13+
</indexterm>
14+
15+
<para>
16+
Each table has a primary heap disk file where most of the data is
17+
stored. To store long column values, there is also a
18+
<acronym>TOAST</> file associated with the table, named based on the
19+
table's oid (actually pg_class.relfilenode), and an index on the
20+
<acronym>TOAST</> table. There also may be indexes associated with
21+
the base table.
22+
</para>
23+
24+
<para>
25+
You can monitor disk space from two places; from inside
26+
<application>psql</> and from the command line using
27+
<application>contrib/oid2name</>. Using <application>psql</> you can
28+
issue queries to see the disk usage for any table:
29+
<programlisting>
30+
play=# SELECT relfilenode, relpages
31+
play-# FROM pg_class
32+
play-# WHERE relname = 'customer';
33+
relfilenode | relpages
34+
-------------+----------
35+
16806 | 60
36+
(1 row)
37+
</programlisting>
38+
</para>
39+
40+
<para>
41+
Each page is typically 8 kilobytes. <literal>relpages</> is only
42+
updated by <command>VACUUM</> and <command>ANALYZE</>. To show the
43+
space used by <acronym>TOAST</> tables, use a query based on the heap
44+
relfilenode:
45+
<programlisting>
46+
play=# SELECT relname, relpages
47+
play-# FROM pg_class
48+
play-# WHERE relname = 'pg_toast_16806' or
49+
play-# relname = 'pg_toast_16806_index'
50+
play-# ORDER BY relname;
51+
relname | relpages
52+
----------------------+----------
53+
pg_toast_16806 | 0
54+
pg_toast_16806_index | 1
55+
</programlisting>
56+
</para>
57+
58+
<para>
59+
You can easily display index usage too:
60+
<programlisting>
61+
play=# SELECT c2.relname, c2.relpages
62+
play-# FROM pg_class c, pg_class c2, pg_index i
63+
play-# WHERE c.relname = 'customer' AND
64+
play-# c.oid = i.indrelid AND
65+
play-# c2.oid = i.indexrelid
66+
play-# ORDER BY c2.relname;
67+
relname | relpages
68+
----------------------+----------
69+
customer_id_indexdex | 26
70+
</programlisting>
71+
</para>
72+
73+
<para>
74+
It is easy to find your largest files using <application>psql</>:
75+
<programlisting>
76+
play=# SELECT relname, relpages
77+
play-# FROM pg_class
78+
play-# ORDER BY relpages DESC;
79+
relname | relpages
80+
----------------------+----------
81+
bigtable | 3290
82+
customer | 3144
83+
</programlisting>
84+
</para>
85+
86+
<para>
87+
You can also use <application>oid2name</> to show disk usage. See
88+
<filename>README.oid2name</> for examples. It includes a script
89+
shows disk usage for each database.
90+
</para>
91+
</sect1>
92+
</chapter>
93+
94+
<!-- Keep this comment at the end of the file
95+
Local variables:
96+
mode:sgml
97+
sgml-omittag:nil
98+
sgml-shorttag:t
99+
sgml-minimize-attributes:nil
100+
sgml-always-quote-attributes:t
101+
sgml-indent-step:1
102+
sgml-indent-data:t
103+
sgml-parent-document:nil
104+
sgml-default-dtd-file:"./reference.ced"
105+
sgml-exposed-tags:nil
106+
sgml-local-catalogs:("/usr/lib/sgml/catalog")
107+
sgml-local-ecat-files:nil
108+
End:
109+
-->

‎doc/src/sgml/maintenance.sgml

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.13 2002/06/1304:36:50 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.14 2002/06/1305:15:22 momjian Exp $
33
-->
44

55
<chapter id="maintenance">
@@ -366,91 +366,6 @@ VACUUM
366366
</sect2>
367367
</sect1>
368368

369-
<sect1 id="diskspace-maintenance">
370-
<title>Disk Space Maintenance</title>
371-
372-
<indexterm zone="diskspace-maintenance">
373-
<primary>disk space</primary>
374-
</indexterm>
375-
376-
<para>
377-
Each table has a primary heap disk file where most of the data is
378-
stored. To store long column values, there is also a
379-
<acronym>TOAST</> file associated with the table, named based on the
380-
table's oid (actually pg_class.relfilenode), and an index on the
381-
<acronym>TOAST</> table. There also may be indexes associated with
382-
the base table.
383-
</para>
384-
385-
<para>
386-
You can monitor disk space from two places; from inside
387-
<application>psql</> and from the command line using
388-
<application>contrib/oid2name</>. Using <application>psql</> you can
389-
issue queries to see the disk usage for any table:
390-
<programlisting>
391-
play=# SELECT relfilenode, relpages
392-
play-# FROM pg_class
393-
play-# WHERE relname = 'customer';
394-
relfilenode | relpages
395-
-------------+----------
396-
16806 | 60
397-
(1 row)
398-
</programlisting>
399-
</para>
400-
401-
<para>
402-
Each page is typically 8 kilobytes. <literal>relpages</> is only
403-
updated by <command>VACUUM</> and <command>ANALYZE</>. To show the
404-
space used by <acronym>TOAST</> tables, use a query based on the heap
405-
relfilenode:
406-
<programlisting>
407-
play=# SELECT relname, relpages
408-
play-# FROM pg_class
409-
play-# WHERE relname = 'pg_toast_16806' or
410-
play-# relname = 'pg_toast_16806_index'
411-
play-# ORDER BY relname;
412-
relname | relpages
413-
----------------------+----------
414-
pg_toast_16806 | 0
415-
pg_toast_16806_index | 1
416-
</programlisting>
417-
</para>
418-
419-
<para>
420-
You can easily display index usage too:
421-
<programlisting>
422-
play=# SELECT c2.relname, c2.relpages
423-
play-# FROM pg_class c, pg_class c2, pg_index i
424-
play-# WHERE c.relname = 'customer' AND
425-
play-# c.oid = i.indrelid AND
426-
play-# c2.oid = i.indexrelid
427-
play-# ORDER BY c2.relname;
428-
relname | relpages
429-
----------------------+----------
430-
customer_id_indexdex | 26
431-
</programlisting>
432-
</para>
433-
434-
<para>
435-
It is easy to find your largest files using <application>psql</>:
436-
<programlisting>
437-
play=# SELECT relname, relpages
438-
play-# FROM pg_class
439-
play-# ORDER BY relpages DESC;
440-
relname | relpages
441-
----------------------+----------
442-
bigtable | 3290
443-
customer | 3144
444-
</programlisting>
445-
</para>
446-
447-
<para>
448-
You can also use <application>oid2name</> to show disk usage. See
449-
<filename>README.oid2name</> for examples. It includes a script
450-
shows disk usage for each database.
451-
</para>
452-
</sect1>
453-
454369

455370
<sect1 id="logfile-maintenance">
456371
<title>Log File Maintenance</title>

‎doc/src/sgml/storage.sgml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp