Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Incomplete
-
Affects Version/s: 10.0.10
-
Fix Version/s: N/A
-
Component/s: None
-
Labels:
Description
In reading about the query cache, I came across an undocumented situation.
https://mariadb.com/kb/en/query-cache/
Basically, the cache should consume queries that always return the same results. With that said, I have noticed that the query cache will cache a query with a LIMIT clause without an ORDER BY clause. This seems incorrect because the LIMIT could return different results for different queries.
For completeness sake, I would suggest not caching queries that use a LIMIT without an ORDER BY clause.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Just because a LIMIT without an ORDER BY could return a different result doesn't mean that the result will be returned from the cache is incorrect.
If the output needs a deterministic order then a ORDER BY should be used.
If no caching is needed then SQL_NO_CACHE can be used.
I'd be of the impression failing to cache LIMIT-full and ORDER BY-less queries would be an unnecessary change in behaviour but that's just my opinion.
What aspect of this is undocumented? There's nothing special about ORDER BY or LIMIT so its not documented as such.