As I already wrote,
COUNT(*) can be
expensive in InnoDB, because this value is not stored in indexes.
Some other storage engines may not store that value. Also,
immediate only if executed on an indexed column. But we don’t
want too many indexes, and some exotic storage engines do not
support indexes – thus, we may need to execute an aggregate
function on a non-indexed column.
Now, the question is: do you really need such values to be exact?
If you need to report statistical values from your database,
probably an error is acceptable. In this case, MariaDB 10
provides a solution: engine-independent statistics.
Note that using this feature may have a …[Read more]