Get the App
SLTechnology News&Howtos  ›  Database  › 

How to check the usage size of each database in mysql and the last modification time of each table in the library

Shulou Source: shulou.com Published: 2022-05-31 15:18:26 10月03日 Update

This article mainly introduces how to check the size of mysql databases and the last modification time of each table in the library. It has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.

These two statements are still relatively common when maintaining mysql at ordinary times

1. View database sizes

SELECT sum(DATA_LENGTH)+sum(INDEX_LENGTH) FROM information_schema.tables where TABLE_SCHEMA='database_name';

The result is in bytes, K divided by 1024 and M divided by 1048576.

2. View the last mysql modification time of the table

SELECT TABLE_NAME,UPDATE_TIME FROM information_schema.tables where TABLE_SCHEMA='database_name';

By looking at the last update time of the table in the database. (It has not been updated for a long time, but it does not mean that it is not used now.)

Thank you for reading this article carefully. I hope Xiaobian will share "How to check the size of mysql databases and the last modification time of each table in the database". This article is helpful to everyone. At the same time, I hope you will support it a lot. Pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Tags: Time article size data database update two middle table representative value interest unit at the same time bytes commonly used more friends knowledge results ribbon Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MariaDB Shulou Technology OPPO Reno Microsoft