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

MySQLMySQLi 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.

raja
Published on 19-Feb-2018 12:02:38
Advertisements