I am dealing with a database that has about 300 tables and I am looking for a way to find all tables that have NO indexes (excluding PRIMARY). Ideally I would like to get back a result set that gives me a count of the number of indexes per table. I have tried this using a query like this:
SELECT
table_name, column_name, index_name, count(table_name) as index_count
FROM
information_schema.statistics
WHERE
index_name != 'primary'
AND
table_schema = 'your_database'
GROUP BY
table_name
but it does not return accurate results. any help would be appreciated
this will result those tables that have no indexes at all (not even primary key)