스키마별 추정 용량

SELECT table_schema,
       ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS total_mib
FROM information_schema.tables
GROUP BY table_schema
ORDER BY total_mib DESC;

특정 스키마의 테이블별 용량

SELECT table_schema, table_name,
       ROUND(data_length / 1024 / 1024, 2) AS data_mib,
       ROUND(index_length / 1024 / 1024, 2) AS index_mib,
       ROUND((data_length + index_length) / 1024 / 1024, 2) AS total_mib
FROM information_schema.tables
WHERE table_schema = 'app_db'
ORDER BY total_mib DESC;

테이블 단위 조회에서 불필요한 GROUP BY를 제거했습니다. 다른 스키마의 같은 이름 테이블을 합치지 않습니다. InnoDB 값은 통계 기반 추정치이며 실제 디스크 사용량과 다를 수 있습니다.