Book Image

MariaDB High Performance

By : Pierre Mavro
Book Image

MariaDB High Performance

By: Pierre Mavro

Overview of this book

Table of Contents (18 chapters)
MariaDB High Performance
About the Author
About the Reviewers

The query cache

The query cache stores the results of the previously executed select statements so that they may be reused if the same query is issued again. If data is updated/added to a table, the query cache is flushed, and the data should be retrieved once again from the disk on the next SELECT query.

When there are too many concurrencies, the query cache could be a bottleneck. Depending on the size of the database and the requested access, here are two scenarios:

  • Smaller database, no high load traffic, no money: The query cache should help you to get fast database access

  • Huge database, high load traffic, money: Disable the query cache, optimize your indexes, spread the read load across several read-only replicas, and use a better caching mechanism, such as Memcache/Redis

A lot of common rules exist, but that doesn't mean they should always be applied. If you do not encounter slowdown due to the query cache, it's fine! You can even tune it to make it faster.

Understanding the query cache...