Estimated MySQL Table Row Count

Ever wanted a quick summary of how many rows are in all of the tables in a MySQL/MariaDB database?

This query will provide that for you. If you’re using the InnoDB storage engine, it’s an estimate; if you’re using MyISAM, then it should be accurate.

SELECT table_schema AS `Database`,
table_name AS `Table`, 
FORMAT(table_rows, 0) AS `Rows`  
FROM information_schema.tables 
-- WHERE table_schema = 'database_name'
ORDER BY table_rows DESC;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.