How Can I check the size of the tables in a particular MySQL database?


As we have checked the size of the MySQL database, similarly we can also check the size of tables in a particular 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)

Here this output gives the size of three tables in the Sample database.

Monica Mona
Monica Mona

Student of life, and a lifelong learner

Updated on: 28-Jan-2020

200 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements