检查MySQL表索引

  • 查看指定表格的索引使用show index命令:

show index from yourtable;
  • 要查看特定schema的所有表格的索引,从INFORMATION_SCHEMA查询STATISTICS表:

SELECT DISTINCT
    TABLE_NAME,
    INDEX_NAME
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = 'your_schema';

参考

Last updated