0

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
nonopolarity
  • 146,324
  • 131
  • 460
  • 740

2 Answers2

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