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, ...

Get MariaDB High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.