在 information_schema 中查找多列索引
Find multi-column index in information_schema
我有一个 table,其索引由 table 中的三列组成。
有什么方法可以在 information_schema 中找到它,还是它只会显示三个单独的索引?
感谢 Radek Postolowicz 的正确方向:
SELECT
table_name AS `Table`,
index_name AS `Index`,
GROUP_CONCAT(column_name ORDER BY seq_in_index) AS `Columns`
FROM information_schema.statistics
WHERE table_schema = 'db'
AND table_name='tbl'
GROUP BY 1,2;
我有一个 table,其索引由 table 中的三列组成。
有什么方法可以在 information_schema 中找到它,还是它只会显示三个单独的索引?
感谢 Radek Postolowicz
SELECT
table_name AS `Table`,
index_name AS `Index`,
GROUP_CONCAT(column_name ORDER BY seq_in_index) AS `Columns`
FROM information_schema.statistics
WHERE table_schema = 'db'
AND table_name='tbl'
GROUP BY 1,2;