반응형
Mysql 목록 표 및 크기 - 크기순 정렬
mysql의 크기를 기준으로 데이터베이스 순서의 모든 테이블을 나열하는 쿼리는 무엇입니까?
해보세요...
SELECT TABLE_NAME, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "schema_name"
ORDER BY (data_length + index_length) DESC;
참고: 교체schema_name위에는 데이터베이스 이름이 있습니다.
mysql 클라이언트에서 다음 쿼리 실행
SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "$DB_NAME"
ORDER BY (data_length + index_length) DESC;
information_schema 데이터베이스에서 다음 쿼리를 실행합니다.
SELECT table_schema AS "Database name",
SUM(data_length + index_length) / 1024 / 1024 AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema
ORDER BY (SUM(data_length + index_length) / 1024 / 1024) DESC;
언급URL : https://stackoverflow.com/questions/14569940/mysql-list-tables-and-sizes-order-by-size
반응형
'programing' 카테고리의 다른 글
| 파이썬, Enum 유형은 무엇에 유용합니까? (0) | 2023.08.28 |
|---|---|
| 데이터베이스 커서가 기본 데이터에 대한 변경 사항을 픽업합니까? (0) | 2023.08.28 |
| VBA에서 ADODB 레코드 세트 전체 복사 또는 복제 (0) | 2023.08.09 |
| Python 모듈 "cx_Oracle" 모듈을 찾을 수 없습니다. (0) | 2023.08.08 |
| jquery를 사용하여 페이지의 특정 위치로 스크롤하려면 어떻게 해야 합니까? (0) | 2023.08.08 |