[MDEV-4682] QUERY CACHE - add STATISTICS per query and show this informations in qc_info plugin Created: 2013-06-19 Updated: 2015-12-07 Resolved: 2015-09-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Plugins, Query Cache |
| Fix Version/s: | 10.1.8 |
| Type: | Task | Priority: | Major |
| Reporter: | roberto spadim | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | plugins, qc_info, querycache | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | 10.1.8-1 | ||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
Change sql_cache.cc and sql_cache.h to add hit rates and statistics Statistics: These categories helps to understand what kind of query we have cached: this allow a better query cache control (MDEV-4584) and a better cache hit rate when optimizing queries with SQL_CACHE/SQL_NO_CACHE — in this case: changing query cache queries (invalidate, table invalidate, reallocation, etc) should handle the stats block too — tables of this plugin: query_cache_queries:
query_cache_queries_tables:
query_cache_tables
|
| Comments |
| Comment by roberto spadim [ 2013-06-19 ] |
|
should use qc_plugin with |
| Comment by roberto spadim [ 2013-06-19 ] |
|
use the same diff_10_0_3_qc_info.cc |
| Comment by roberto spadim [ 2013-07-07 ] |
|
sergey, should i put some #ifdef, and make statistic a option when compiling the source? |
| Comment by roberto spadim [ 2014-06-16 ] |
|
hi guys, now i'm with time to code a bit more, could we consider a review of this MDEV? about informations, the statistic data, is nice to me, i could search queries that should be SQL_NO_CACHE and queries that could be SQL_CACHE very easy, and check if cache is doing a good job thanks guys |
| Comment by roberto spadim [ 2014-07-16 ] |
|
hi, guys, i was thinking about using audit plugin to collect statistic about query cache, could it work? i'm confuse about query cache invalidation, if audit plugin could solve this problem or not, any idea if i will have problems? the 'bad' part of this today implementation patch, is the change of sql_cache.cc and sql_cache.h source code, it change structures of cache code at sql_cache.h |
| Comment by roberto spadim [ 2014-09-20 ] |
|
sending patchs via pull request at github |
| Comment by roberto spadim [ 2014-09-20 ] |
|
there's one TODO, use or not use statistics with query cache, since it increase memory use should be nice turn it off/on, at least at compile time, but should be nice if it could be done at runtime, for example, turning statistics on/off release all memory and queries and restart query cache again with a new 'table' (a block of memory) of statistics if it's on, if it's off don't use this 'table' |
| Comment by Oleksandr Byelkin [ 2014-09-30 ] |
|
Before using try_lock() it is better to check of is_disabled() to avoid delay in case of changing QC state. |
| Comment by roberto spadim [ 2014-09-30 ] |
|
nice i will include it now |
| Comment by roberto spadim [ 2014-09-30 ] |
|
updated: https://github.com/rspadim/server/commit/7bca392c82959b7e211822f988b95832f3e2d96a qc->is_disabled() before all try_lock(thd) |
| Comment by roberto spadim [ 2014-10-13 ] |
|
i think we are ok to review must check if i done the right work with test files one doubt is... query_id should be a number from 1......infinte, or there's a hash table value like a primary key or something like it? |
| Comment by Daniel Black [ 2015-03-19 ] |
|
Looks good. Seems documentation is ahead of code a bit this time - https://mariadb.com/kb/en/mariadb/query_cache_info-plugin/ probably needs a little more work to describe which tables are in which versions. |
| Comment by Oleksandr Byelkin [ 2015-03-22 ] |
|
It should be mentioned that using this plugin (during fetching data from information schema) lock QC. So one who use it should be aware of it and do not make DoS on his server by frequent requests. |
| Comment by Daniel Black [ 2015-05-17 ] |
|
https://github.com/MariaDB/server/pull/67/files is now the basic Query Cache Info plugin with decoding of query cache flags and test cases that show most of the query cache flags changed by server variables. Hoping it is suitable for 10.0 as well as 10.1 Edit: was incomplete. Now isn't. |
| Comment by roberto spadim [ 2015-12-07 ] |
|
nice, now just need some statistics, flags are ok |