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? thanks.
views:
41answers:
2
Q:
Using MySQL, is there any way to dump the count of records in each of all 200 tables in a database?
+2
A:
Does show table status work for your problem? It has the row counts?
Rob Di Marco
2010-05-24 19:50:08
Warning: This is accurate for MyISAM, but the row count for InnoDB is just an estimate.
Ike Walker
2010-05-24 20:24:23
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)?
動靜能量
2010-05-24 21:03:58
+2
A:
SELECT table_name,
table_rows
FROM `information_schema`.`tables`
WHERE table_schema = '<Your Database Name>'
ORDER BY table_rows DESC
Mark Baker
2010-05-24 19:52:01
Again: This is accurate for MyISAM, but the row count for InnoDB is just an estimate.
Ike Walker
2010-05-24 20:24:53