Reputation: 261
SELECT SQ_CACHE * FROM TABLE where ID=1
Questions:
ID=1
updates still my cache be maintained?Upvotes: 3
Views: 1063
Reputation: 8821
* Aside from some corner-cases or bugs maybe.
The "short" answer (note: specific to MySQL) would be: AFAIK MySQL caches on table level granularity; so any change on that table would invalidate all cached results for that table. Other than that, only deterministic queries will get cached, transactions might bypass/invalidate caches, the query cache doesn't support prepared statements, queries must be absolutely exactly be the same for the cache to kick in at all (so an extra space in a query would cause a cache miss) and subqueries aren't supported. And then there are still other factors involved. Maybe some things have changed in more recent versions but these are, some (not all!) of the factors that used to be involved. Correct me if I'm wrong.
Upvotes: 4