views:

20

answers:

1

IHello,

I'm trying to count for each table in my MySQL database how many records there are in it.

All of my tables happen to be in InnoDB and this query

SELECT TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'myschema';

is way much too much of an estimate (There are +846 records and it tells me there are only +-400)

Is there a way to count a more exact number of rows with a similar query? It doen't matter how long the query takes tot run. (P.S. not using php or a similar language)

A: 

If the length of the query doesn't matter then what about doing the following for each table in your database:

select Count(*) from MyTable
DJ Quimby