MySQL · SQL
SELECT CONCAT(t.table_schema, '.', t.table_name) AS table_name,
t.table_rows AS estimated_rows,
t.engine
FROM information_schema.tables t
LEFT JOIN information_schema.table_constraints c
ON c.table_schema = t.table_schema
AND c.table_name = t.table_name
AND c.constraint_type = 'PRIMARY KEY'
WHERE t.table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
AND t.table_type = 'BASE TABLE'
AND c.constraint_name IS NULL
ORDER BY t.table_rows DESCThis query is part of the "MySQL health" pack: connect the database in DataRunner and install the whole pack — queries, dashboard and checks — at once.
- Check that ships with it: Every table has a primary key