質問

I have read the query_cache as a very important tool to improve query performance.

A general recommendation would be to have it enabled to on-demand (using SELECT SQL_CACHE, with a query_cache_type = 2 config setting).

  • What type of circumstances would make the query_cache more optimal in MySQL?
役に立ちましたか?

解決

The usefullness of the query-cache is mainly dependent on 4 things:

  • How good are the chances for repetition of (nearly) identical queries?
  • How often is data used in the repeated queries changed?
  • Do those repeated queries have small result-sets?
  • How long do the repeated queries take without query-caching?

A simple example: say you have a big table with 10 billion rows and you query a difficult "count" operation on it. It will last very long, give you a tiny result-set. Now if you repeatedly execute that query without changing the table too often, the benefit of query-caching is simply huge.

I hope the principles are somewhat clearer now.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top