0
시나리오 : 10 개 이상의 테이블이있는 데이터베이스가있는 Android 애플리케이션. 서버에서 sq-lite (모바일) 데이터베이스로 데이터를 가져와 저장해야합니다. 이 작업을 효율적으로 수행하기 위해 각 테이블의 행 크기를 계산할 계획이었습니다. 길이는 속성에 할당됩니다.mysql을 사용하여 테이블 크기 추정
----------------------------------------------------------------------------------
| table_name | Size of single row with defined attributes length |
|----------------------------------------------------------------------------------|
| table_1 | size |
|----------------------------------------------------------------------------------|
| table_2 | size |
|----------------------------------------------------------------------------------|
| table_3 | size |
----------------------------------------------------------------------------------
생성하는 동안 속성에 할당 된 길이와 관련하여 테이블의 단일 행 길이를 계산하는 mysql 쿼리가 있습니까? 가장 먼저 데이터베이스의 모든 테이블의 크기를 나열
SELECT table_name AS "Table",
round(((data_length + index_length)/1024/1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "$DB_NAME"
AND table_name = "$TABLE_NAME";
하거나 쿼리 : 내가 할
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;