深入理解MySQL——查看没有创建索引的表

SELECT
	*
FROM
	information_schema.`TABLES` t
LEFT JOIN information_schema.STATISTICS s ON t.TABLE_SCHEMA = s.TABLE_SCHEMA
AND t.table_name = s.TABLE_NAME
AND s.INDEX_NAME = 'PRIMARY'
WHERE
	t.TABLE_SCHEMA NOT IN (
		'mysql',
		'performance_schema',
		'information_schema',
		'sys'
	)
AND TABLE_TYPE = 'BASE TABLE'
AND s.INDEX_NAME IS NULL;

你可能感兴趣的:(深入理解MySQL,mysql,数据库)