I have a table using innodb. I know the table has roughly 89 million rows. Using
SELECT COUNT(*) FROM table;
takes about five minutes to run. I
If you are ok with approximate number of records, you can use output of "explain".
explain
Simplified verion of the code is
$result = mysql_query('explain SELECT count(*) from TABLE_NAME'); $row = mysql_fetch_assoc($result); echo $row['rows'];