SELECT a.TABLE_SCHEMA,
a.TABLE_NAME,
a.INDEX_NAME,
CASE a.NON_UNIQUE WHEN 1 THEN '非唯一' ELSE '唯一' END AS 唯一性,
group_concat(COLUMN_NAME ORDER BY SEQ_IN_INDEX) AS 列,
group_concat(NULLABLE ORDER BY SEQ_IN_INDEX) AS 可空,
group_concat(CARDINALITY ORDER BY SEQ_IN_INDEX) AS 散列程度,
sum(CARDINALITY) AS 总散列程度
FROM information_schema.statistics a
GROUP BY a.TABLE_SCHEMA,a.TABLE_NAME,a.INDEX_NAME,a.NON_UNIQUE;
SELECT column_name, count(*)
FROM information_schema.statistics
GROUP BY column_name
ORDER BY count(*) DESC