mysql查询表信息及数据量


mysql查询表信息及数据量

##查看所有表信息
SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'test'
##查看各个表数据量
SELECT table_name,table_rows FROM information_schema.tables WHERE TABLE_SCHEMA = 'test' ORDER BY table_rows DESC;
##查询schema的相关信息
SELECT * FROM information_schema.tables WHERE TABLE_SCHEMA = 'test' AND table_rows >0 ORDER BY table_rows DESC;