SELECT
a.TABLE_SCHEMA,
a.TABLE_NAME,
a.index_name,
GROUP_CONCAT(
column_name
ORDER BY
seq_in_index
) AS `Columns`
FROM
information_schema.statistics a
GROUP BY
a.TABLE_SCHEMA,
a.TABLE_NAME,
a.index_name;
SELECT
a.TABLE_SCHEMA,
a.TABLE_NAME,
a.index_name,
GROUP_CONCAT(
column_name
ORDER BY
seq_in_index
) AS `Columns`
FROM
information_schema.statistics a
GROUP BY
a.TABLE_SCHEMA,
a.TABLE_NAME,
a.index_name;
SELECT
TABLE_NAME,
INDEX_NAME,
GROUP_CONCAT(COLUMN_NAME) AS INDEX_COLUMN
FROM
information_schema.statistics
GROUP BY
TABLE_NAME,
INDEX_NAME;
select
table_schema as '数据库',
sum(table_rows) as '记录数',
sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)',
sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'
from information_schema.tables
group by table_schema
order by sum(data_length) desc, sum(index_length) desc;