Say if there is a database that has 200 tables, is there a quick way to see how many records are in each table, if possible, sorted by the number of records descendingly?
Asked
Active
Viewed 182 times
0
-
Do you mean: Is there a quick way to see how many records are in each *table*? – Mark Byers May 24 '10 at 19:46
-
Exact duplicate: http://stackoverflow.com/questions/286039/get-record-counts-for-all-tables-in-mysql-database – Satanicpuppy May 24 '10 at 19:53
-
Possible duplicate of [Get record counts for all tables in MySQL database](https://stackoverflow.com/questions/286039/get-record-counts-for-all-tables-in-mysql-database) – Brian Tompsett - 汤莱恩 May 30 '17 at 18:42
2 Answers
2
Does show table status work for your problem? It has the row counts?

Rob Di Marco
- 43,054
- 9
- 66
- 56
-
Warning: This is accurate for MyISAM, but the row count for InnoDB is just an estimate. – Ike Walker May 24 '10 at 20:24
-
the result is very wide, can't show each row on 1 line even when console is 250 characters wide. Is there a way to selectively show parts of this table (and sorted on count)? – nonopolarity May 24 '10 at 21:03
2
SELECT table_name,
table_rows
FROM `information_schema`.`tables`
WHERE table_schema = '<Your Database Name>'
ORDER BY table_rows DESC

Mark Baker
- 209,507
- 32
- 346
- 385
-
Again: This is accurate for MyISAM, but the row count for InnoDB is just an estimate. – Ike Walker May 24 '10 at 20:24