linux/DB
mysql DB & table 별 용량 체크
배움엔 끝이없다
2021. 5. 18. 11:08
728x90
반응형
######DB 별 용량 체크#####
SELECT table_schema "Database Name",
SUM(data_length + index_length) / 1024 / 1024 "Size(MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
######TABLE 별 용량 체크#####
SELECT
concat(table_schema,'.',table_name),
concat(round(data_length/(1024*1024*1024),2),'G') DATA,
concat(round(index_length/(1024*1024*1024),2),'G') idx,
concat(round((data_length+index_length)/(1024*1024*1024),2),'G') total_size,
round(index_length/data_length,2) idxfrac
FROM information_schema.TABLES
WHERE table_rows is not null;
728x90
반응형
LIST