본문 바로가기
DB/Postgresql

PostgreSQL 테이블 용량 확인하기

by fabxoe 2020. 6. 15.

1.     테이블별 사이즈

A.     테이블 스페이스 총량

=> select spcname, pg_size_pretty(pg_tablespace_size(spcname)) from pg_tablespace;

B.      각 테이블별 사이즈

=>  Index 미포함 : select pg_relation_size(TableName);

=>  Index 포함 : select pg_total_relation_size(TableName);

C.      인덱스 사이즈

=>  select pg_relation_size(IndexName);

D.     총 사이즈(데이터 + 인덱스)

=>  select pg_total_relation_size(TableName);

 

--------------------------

단위 적용 : pg_size_pretty()

DB 사이즈:

=>  select pg_size_pretty(pg_database_size(DBName));

 

사용 예시) select pg_size_pretty(pg_total_relation_size('aiops_train_history'));


출처: https://korearank1.tistory.com/43

 

PostgreSQL 테이블 사이즈, 스페이스 사이즈. 인덱스 사이즈

1.    테이블별 사이즈 A.    테이블 스페이스 총량 => select spcname, pg_size_pretty(pg_tablespace_size(spcname)) from pg_tablespace; B.     각 테이블별 사이즈 ð Index 미포함 : select pg_re..

korearank1.tistory.com

댓글