如何查看数据库表中最大的库表


最近服务数据库服务器由于空间不足导致数据库锁表无法操作需要分析到底是哪个库表占据的空间最大。

SELECT table_schema                                           AS 'Database',
       table_name                                             AS 'Table',
       round(((data_length + index_length) / 1024 / 1024), 3) AS 'Size in MB'
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC

会输出如下数据: 告诉你哪个库的哪个表对应的数据数据量有多大

Database Table Size in MB
duxiaoman cash_loan 4565.734
vxlink_business_agent_server cash_loan 3575.000
vxlink_registration_server uc_contact 2778.766
vxlink_registration_server ta_case_info 1903.531
vxlink_registration_server uc_privacy 1503.750
duxiaoman cash_loan_rate 1371.000
standard_process ACT_GE_BYTEARRAY 899.672

评论