27

The FAQ of PHPMyAdmin has this to say about its approximate row counts for InnoDB:

phpMyAdmin uses a quick method to get the row count, and this method only returns an approximate count in the case of InnoDB tables.

I would like to use this 'quick method' - but everywhere I search seems to have a different answer.

Does anyone know?

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Grim...
  • 16,518
  • 7
  • 45
  • 61
  • 1
    what are the various methods you found, and did any of them do what you want? – Mat May 21 '11 at 15:55

1 Answers1

39

They do this:

SHOW TABLE STATUS LIKE 'foo';

This returns a 'Rows' column. With MyISAM it's 100% accurate, InnoDB just guesses. This is why MyISAM is faster than InnoDB when doing a 'SELECT COUNT(*)' query without a where clause.

phpMyAdmin is open-source, so you can just go into the code and see for yourself!

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055