3 ms·
I was under the perhaps false impression that count star queries with or without where conditions are not cached on innodb tables.
by kylebragger 16y ago
I was under the perhaps false impression that count star queries with or without where conditions are not cached on innodb tables.
- ars 16y agoNot 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.