0

I am new to DBA stack exchange & this is my first question. Kindly help me in finding a low level documentation for Query Cache module in MySQL since I am planning to work with the source code of Query Cache. I googled a lot but I was provided with only high level details. Is it available in MySQL website (I tried but not an exhaustive search)? Please help me.

1

This is the best documentation available for the query cache:

sql_cache.cc

I am not kidding, the header of that file contains the most detailed overview I have ever found. Next thing is the own code, which is on the very same link.

There is a query cache chapter on this book, and this other book, but only 4-5 paragraphs, in the context of its relation with the handlers interface.

Apart from that, you should read the general internals code guide.

  • 1
    <Gulp...> The MySQL developers obviously never read this - goto "harmful" :-) - there are 25 of them in that routine! – Vérace Jul 16 '14 at 20:37
  • [OFFTOPIC] I won't be the one telling that Dijkstra is wrong, but I consider c2.com/cgi/wiki?GoTo a value discussion, specifically for low-level programs like Linux or MySQL. As it says: The apprentice uses it without thinking. The journeyman avoids it without thinking. The master uses it thoughtfully. – jynus Jul 16 '14 at 21:57
  • 1
    My comment was tongue-in-cheek! I read somewhere that "C allows you to do very stupid things because it allows you to do very clever things". I'm sure that the MySQL programmers would have come up with a better solution if there was one for this particular piece of code. – Vérace Jul 16 '14 at 22:14
1

I hope you are sitting down because I have a hardcore reality check for you.

InnoDB and the MySQL Query Cache have been fiercely known to be at war with one another.

I am a staunch advocate of disabling the Query Cache with a DB that mostly or all InnoDB.

Here are my posts where I discuss why:

Why is this worth bringing up at this time ? You said you are planning to work with the source code of Query Cache. If you do manage to control the Query Cache's underlying data structure, mechanisms, and algorithms, then you will affect the way InnoDB invalidates query cache entries (or at least the speed it invalidates).

In many cases, knowing the size of result sets and a properly sized Query Cache can help you tune query_cache_min_res_unit and the query_cache_size.This can minimize InnoDB's heavy-handed interaction and overall query performance. This would be a greater endeavor that trying to change the Query Cache at the source code level.

If you must do so, you should read through these posts from mysqlperformanceblog.com. That way, when you jump into the ocean, you don't encounter any hidden rocks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.