본문 바로가기
mysql

🥰 mysql 테이블의 현재 사용량을 조회하여 확인

by Knowledge Store In Hyunsoft 2020. 6. 13.
  • mysql 테이블의 현재 사용량을 조회하여 확인
SELECT engine,
       count(*) AS table_count,
       concat(round(sum(table_rows)/1000000,2),'M') AS table_rows,
       concat(round(sum(data_length)/(1024*1024*1024),2),'G') AS total_data,
       concat(round(sum(index_length)/(1024*1024*1024),2),'G') AS total_index,
       concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') AS total_size,
       round(sum(index_length)/sum(data_length),2) AS index_frac
  FROM information_schema.TABLES
 GROUP BY engine
 ORDER BY sum(data_length+index_length) DESC

 

  • 결과 샘플

728x90

댓글