Minggu, 28 November 2021

Check Databases and Tables Size Mysql MariaDB

  Tidak ada komentar

Check Mysql Databases Size

MariaDB [(none)]> show databases;
+---------------------+
| Database            |
+---------------------+
| information_schema  |
| mysql               |
| performance_schema  |
| portal_final |
+---------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]>
MariaDB [(none)]> SELECT table_schema "DB Name",
    ->         ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
    -> FROM information_schema.tables
    -> GROUP BY table_schema;
+---------------------+---------------+
| DB Name             | DB Size in MB |
+---------------------+---------------+
| information_schema  |           0.1 |
| mysql               |           0.6 |
| performance_schema  |           0.0 |
| portal_final        |        2477.2 |
+---------------------+---------------+
4 rows in set, 2 warnings (0.15 sec)

MariaDB [(none)]> exit

Check Mysql Table Size

MariaDB [(none)]> SELECT table_name AS "Table", ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)" FROM information_schema.TABLES WHERE table_schema = "ilk3db" ORDER BY (data_length + index_length) DESC;
+----------------+-----------+
| Table          | Size (MB) |
+----------------+-----------+
| pkk_rambutan   |    598.67 |
| pkk_melon      |    536.73 |
| m_apel         |     19.61 |
| m_jeruk        |      2.34 |
+----------------+-----------+
4 rows in set (0.001 sec)

MariaDB [(none)]>

Tidak ada komentar :

Posting Komentar