| 用途 | 元数据查询 |
|---|---|
| 常用表 | tables / columns / statistics / key_column_usage |
| 注意 | 大实例上全表扫描有开销 |
常用查询
常用查询
SELECT table_name, table_comment FROM information_schema.tables
WHERE table_schema='appdb' AND table_type='BASE TABLE';
SELECT index_name, GROUP_CONCAT(column_name ORDER BY seq_in_index) AS cols
FROM information_schema.statistics
WHERE table_schema='appdb' AND table_name='orders'
GROUP BY index_name;8.0 的 information_schema 直接读数据字典,比 5.7 快很多;高频统计仍建议落监控库。