On 02/08/07, Thomas Dalton thomas.dalton@gmail.com wrote:
Kinda? That's a 100% error! MySQL's count() function is worse than I thought... how much less efficient is the accurate method? Could we cache the accurate value every 10 minutes or so and display that?
The issue here is that COUNT(*) is an horrendous operation on a large InnoDB table, owing to the fact that the value isn't stored, and has to be recalculated on demand. The estimate comes from running a quick EXPLAIN SELECT and represents the number of rows the engine believes might be involved, offhand.
Caching the accurate value would be of no benefit.
Rob Church