DB별, Table별 데이터 사이즈
[MySQL 운영]/MySQL Tip 2021. 1. 28. 15:31 |DB별 데이터 사이즈 확인
select Table_Schema, round(sum(data_length/1024/1024),3) as `Data-Size (Mb)`, round(sum(index_length/1024/1024),3) as `Index-Size(Mb)`,
round(sum(data_length/1024/1024)+sum(index_length/1024/1024),3) as 'Total-Size(Mb)'
from information_schema.tables
where table_schema not in ('information_schema','dbstat','mysql','performance_schema','test')
group by Table_Schema
union all
select '---------------', '---------------', '---------------','---------------'
union all
select 'Total SUM', round(sum(data_length/1024/1024),1) as `Data-Size (Mb)`, round(sum(index_length/1024/1024),3) as `Index-Size(Mb)`,
round(sum(data_length/1024/1024)+sum(index_length/1024/1024),0) as 'Total-Size(Mb)'
from information_schema.tables
where table_schema not in ('information_schema','dbstat','mysql','performance_schema','test','sys');
select Table_Schema,
round(sum(data_length/1024/1024/1024)+sum(index_length/1024/1024/1024),0) as 'Total-Size(Gb)'
from information_schema.tables
where table_schema not in ('information_schema','dbstat','mysql','performance_schema','test')
group by Table_Schema
union all
select '---------------', '---------------'
union all
select 'Total SUM',
round(sum(data_length/1024/1024/1024)+sum(index_length/1024/1024/1024),0) as 'Total-Size(Gb)'
from information_schema.tables
where table_schema not in ('information_schema','dbstat','mysql','performance_schema','test');
Table별 데이터 사이즈 확인
select Table_Schema,table_name,
round(sum(data_length/1024/1024)+sum(index_length/1024/1024),0) as 'Total-Size(Mb)'
from information_schema.tables
where table_schema not in ('information_schema','dbstat','mysql','performance_schema','test','sys')
group by Table_Schema,table_name
union all
select '---------------', '---------------' ,'---------------'
union all
select 'Total SUM',table_name,
round(sum(data_length/1024/1024)+sum(index_length/1024/1024),0) as 'Total-Size(Mb)'
from information_schema.tables
where table_schema not in ('information_schema','dbstat','mysql','performance_schema','test','sys');
'[MySQL 운영] > MySQL Tip' 카테고리의 다른 글
MySQL 잠금 확인 방법 (0) | 2021.01.29 |
---|---|
tmp_table_size 와 max_heap_table_size 차이 (0) | 2021.01.29 |
pt online schema change (0) | 2021.01.28 |
mysql show processlist ip 확인하기 (0) | 2021.01.28 |
MySQL 미사용 인덱스 조회 (0) | 2021.01.28 |
mysql 선택도 나쁜 인덱스 조회 방법 (0) | 2021.01.28 |
쿼리 진행율 확인 (0) | 2021.01.28 |