Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要从给定表中选择所有索引。
但是,当索引中有多个列时,MySQL 会使用所有可能的列组合创建多个具有相同名称的索引。
所以 SHOW INDEXES 多次返回相同的值。
有没有办法进行选择不同以从给定表中获取索引名称?
如果可能的话,这不是 MySQL 特定的。
请尝试以下查询:
SELECT DISTINCT INDEX_NAME FROM information_schema.statistics WHERE table_schema = 'your_schema' AND table_name = 'your_table'