時(shí)間:2024-02-08 11:17作者:下載吧人氣:24
最初是想找postgresql數(shù)據(jù)庫(kù)占用空間命令發(fā)現(xiàn)的這篇blog,發(fā)現(xiàn)其中提供的幾
條命令很有用(但也有幾條感覺(jué)是充數(shù)的=。=),于是就把它翻譯過(guò)來(lái)了。另外這篇文章是09年的,所以里面的內(nèi)容可能有點(diǎn)過(guò)時(shí),我收集了原文中有用的評(píng)論放在了最后面。
現(xiàn)在有不少開(kāi)源軟件都在使用postgreSQL作為它們的數(shù)據(jù)庫(kù)系統(tǒng)。但公司可能不會(huì)招一些全職的postgreSQL DBA來(lái)維護(hù)它(piglei: 在國(guó)內(nèi)基本也找不到)。而會(huì)讓一些比如說(shuō)Oracle DBA、Linux系統(tǒng)管理員或者程序員去 維護(hù)。在這篇文章中我們會(huì)介紹15個(gè)無(wú)論是對(duì)psql老鳥(niǎo)還是DBA都非常實(shí)用的postgresql數(shù)據(jù)庫(kù)命令。
1. 如何找到postgreSQL數(shù)據(jù)庫(kù)中占空間最大的表?
$ /usr/local/pgsql/bin/psql test
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.
Type: copyright for distribution terms
h for help with SQL commands
? for help with psql commands
g or terminate with semicolon to execute query
q to quit
test=# SELECT relname, relpages FROM pg_class ORDER BY relpages DESC;
relname | relpages
———————————–+———-
pg_proc | 50
pg_proc_proname_args_nsp_index | 40
pg_depend | 37
pg_attribute | 30
網(wǎng)友評(píng)論