[MDEV-6631] No cache directive(SQL_CACHE) query still wait for "query cache lock" on query_cache_type=DEMAND mode Created: 2014-08-22 Updated: 2022-11-08 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Query Cache |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Seunguck Lee | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | patch | ||
| Issue Links: |
|
||||||||
| Description |
|
According to the MySQL manual, http://dev.mysql.com/doc/refman/5.6/en/query-cache-configuration.html "A value of 2 or DEMAND causes caching of only those statements that begin with SELECT SQL_CACHE." But, No cache directive query still wait for query cache lock on query_cache_type=2(DEMAND) mode server.
In the source code, server only checks if there's SQL_NO_CACHE directive. They don't care what is current query_cache_type.
So, I think server should check both of query_cache_type and sql cache directive.
|
| Comments |
| Comment by roberto spadim [ 2014-09-23 ] |
|
there's one problem since we can include queries to query cache when using query_cache_type=1 and after some time with queries without SQL_CACHE, change the variable to query_cache_type=2 |
| Comment by roberto spadim [ 2014-10-18 ] |
|
hi guys, could review this and commit in the main line? |
| Comment by Daniel Black [ 2014-11-19 ] |
|
Roberto, I looked at your patch and noticed that it won't catch other SELECT modifiers like You may need some more buffer over-read protection in has_sql_cache_directive |
| Comment by roberto spadim [ 2014-11-19 ] |
|
humm probably we have this same problem to |
| Comment by roberto spadim [ 2014-11-19 ] |
|
maybe we should consider more than only one MDEV? maybe this one, and another to allow SQL_NO_CACHE / SQL_CACHE with a faster return from query cache? i vote for a search of about +50~100bytes to handle this SQL_NO_CACHE/SQL_CACHE search, but check that's not a big problem, just change the "has_sql_cache_directive" AND "has_no_cache_directive" |
| Comment by roberto spadim [ 2014-11-19 ] |
|
i created a sub task just to this problem: |
| Comment by roberto spadim [ 2014-11-19 ] |
|
Daniel Black, the only "100%" solution should execute a parser of query, before checking query cache, any other method will implement a 'parser like' feature, this implemented a single search, i think we should leave this 'problem' open here, and leave it to the other mdev (7132), with more time we could check how much buffer should we check (or not) |
| Comment by roberto spadim [ 2015-09-03 ] |
|
Elena, this one i think should be merged, since this have performace loss, the |
| Comment by roberto spadim [ 2015-09-03 ] |
|
from https://dev.mysql.com/doc/refman/5.7/en/select.html that's not true select SQL_CACHE ..... from (select SQL_NO_CACHE ....) as tmp |