■ 테이블 크기를 조회하는 방법을 보여준다.
▶ 예제 코드 (SQL)
1 2 3 4 5 6 7 8 9 10 11 |
SELECT N.NSPNAME || '.' || C.RELNAME AS RELATION ,PG_SIZE_PRETTY(PG_TOTAL_RELATION_SIZE(C.OID)) AS TOTAL_SIZE FROM PG_CLASS C LEFT JOIN PG_NAMESPACE N ON N.OID = C.RELNAMESPACE WHERE NSPNAME NOT IN ('pg_catalog', 'information_schema') AND C.RELKIND <> 'i' AND N.NSPNAME !~ '^pg_toast' ORDER BY RELATION ASC; |