3 ms·
Not exactly. On isam table the count(*) queries can sometimes directly lookup the answer from the index, or the table statistics. On innodb, because of transac
by ars 16y ago
Not exactly. On isam table the count(*) queries can sometimes directly lookup the answer from the index, or the table statistics.
On innodb, because of transactions, this is not possible, and it needs to actually count the rows.
BUT, the query itself is still cached - at least until the underlying table gets updated, which invalidates the cache (I'm not sure of the exact invalidation strategy, but it's part of MySQL and doesn't depend on the engine).
- chrisbolt 16y agoUpdating the table invalidates all cached queries that refer to that table, making the query cache useless for any site that gets a decent amount of updates.