postgresql-查看各個數據庫大小


查看各個數據庫表大小(不包含索引),以及表數據量
mysql:
select table_name,concat(round((DATA_LENGTH/1024/1024),2),'M')as size,table_rows from information_schema.tables order by table_rows desc limit 20
 
postgresql:
select table_schema,TABLE_NAME,reltuples,pg_size_pretty(pg_total_relation_size('"' || table_schema || '"."' || table_name || '"'))
from pg_class,information_schema.tables where relname=TABLE_NAME
ORDER BY reltuples desc limit 20
 
Sybase:
據空間大小的:
1.sybase(以16k邏輯頁為例)
use YWST
go
select top 10 object_name(id) tabName,rowcnt rowCnt,convert(varchar,(pagecnt*16/1024)) + 'M' dataSize from systabstats order by rowcnt desc
 
oracle:
查記錄條數可以用如下語句:
select *  from user_tables t where t.NUM_ROWS is not null order by t.NUM_ROWS desc 。
表實際使用的空間:
select num_rows * avg_row_len 
from user_tables


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM