MySQL - How to count all rows per table in one query

Lee picture Lee · Apr 22, 2010 · Viewed 66.3k times · Source

Is there a way to query the DB to find out how many rows there are in all the tables?

i.e.

table1 1234
table2 222
table3 7888

Hope you can advise

Answer

great_llama picture great_llama · Apr 22, 2010
SELECT 
    TABLE_NAME, 
    TABLE_ROWS 
FROM 
    `information_schema`.`tables` 
WHERE 
    `table_schema` = 'YOUR_DB_NAME';