Home > Database > Mysql Tutorial > How to check the size of a table in a specific MySQL database?

How to check the size of a table in a specific MySQL database?

王林
Release: 2023-09-02 15:09:04
forward
717 people have browsed it

如何检查特定 MySQL 数据库中表的大小?

Just like we have checked the size of the MySQL database, we can also check the size of the tables in a specific database. It can be done as follows -

mysql> SELECT
    -> table_name AS "Table",
    -> round(((data_length + index_length) / 1024 / 1024), 2) as SIZE
    -> FROM information_schema.TABLES
    -> WHERE table_schema = "SAMPLE"
    -> ORDER BY SIZE;
+-------------+-------+
| Table       | SIZE  |
+-------------+-------+
| employee    | 0.02  |
| student     | 0.02  |
| new_student | 0.02  |
+-------------+-------+
3 rows in set (0.00 sec)
Copy after login

The output here gives the Example size of the three tables in the database.

The above is the detailed content of How to check the size of a table in a specific MySQL database?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template