Home >Database >Mysql Tutorial >Detailed example of how to check the table size in MySql

Detailed example of how to check the table size in MySql

黄舟
黄舟Original
2017-08-11 14:22:341864browse

When the database takes up a lot of space, you can use the following statement to find a table with a large amount of data


SELECT 
    TABLE_NAME
    ,round((DATA_LENGTH/1024/1024),2)  'DATA_SIZE(M)'
    ,round((INDEX_LENGTH/1024/1024),2)  'INDEX_SIZE(M)'
    ,AVG_ROW_LENGTH
    ,MAX_DATA_LENGTH
    ,CREATE_TIMEFROM information_schema.tablesWHERE TABLE_SCHEMA ='库名'ORDER BY 2 desc;

Running results

The above is the detailed content of Detailed example of how to check the table size in MySql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn