Database/Postgresql

postgresql 혹은 timescale 에서 전체 테이블 크기 구하기

LukeHan1128 2023. 9. 17. 20:00
반응형

 

select
  table_schema,
  table_name,
  pg_relation_size(table_schema||'.'||table_name),
  pg_size_pretty(pg_relation_size(quote_ident(table_name))),
  pg_size_pretty(hypertable_size(table_schema||'.'||table_name)) as pg_size_pretty_ts,
  pg_relation_size(quote_ident(table_name))
from
  information_schema.tables
where
	table_schema = 'public'
order by 3 desc;

 

  • pg_size_pretty(pg_relation_size(quote_ident(table_name))) : postgres 테이블 크기
  • pg_size_pretty(hypertable_size(table_schema||'.'||table_name)) as pg_size_pretty_ts : timescale 테이블 크기

 

반응형