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

Commit9bba67a

Browse files
committed
Add script to show disk space per db.
1 parent4f8795e commit9bba67a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

‎contrib/oid2name/README.oid2name

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Oid of table ips from database "test":
8484
---------------------------------
8585
18737 = ips
8686

87+
$ # show disk space for every db object
8788
$ du * | while read SIZE OID
8889
> do
8990
>echo "$SIZE `oid2name -q -d test -o $OID`"
@@ -92,6 +93,7 @@ $ du * | while read SIZE OID
9293
36 18722 = cities
9394
...
9495

96+
$ # same as above, but sort by largest first
9597
$ du * | while read SIZE OID
9698
> do
9799
>echo "$SIZE `oid2name -q -d test -o $OID`"
@@ -101,6 +103,18 @@ $ du * | while read SIZE OID
101103
1950 23903 = customers
102104
...
103105

106+
$ # show disk usage per database
107+
$ cd /u/pg/data/base
108+
$ du -s * |
109+
> while read SIZE OID
110+
> do
111+
>echo "$SIZE `aspg oid2name -q | grep ^$OID' '`"
112+
> done |
113+
> sort -rn
114+
2256 18721 = test
115+
2135 18735 = postgres
116+
..
117+
104118
This can be done in psql with: (each page is typically 8k)
105119

106120
test=> SELECT relpages, relfilenode, relname FROM pg_class ORDER BY relpages DESC;
@@ -112,4 +126,3 @@ Mail me with any problems or additions you would like to see. Clearing
112126
house for the code will be at: http://www.crimelabs.net
113127

114128
b. palmer, bpalmer@crimelabs.net
115-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp