Ip ziet
Ip ziet

Reputation: 307

Mysql cache for SELECT...IN

Is "SELECT * FROM PRODUCT where Id in (.. iDList..)" with iDList changed partially cached by MySQL?

As the query is executed thousand of times per minute, it would be helpful if MySQL can cache those rows.

Sorry if my question is dumb..

Upvotes: 1

Views: 299

Answers (1)

Shadow
Shadow

Reputation: 34230

Unfortunately mysql's query cache caches complete queries only, which are only retrieved if exactly the same query is submitted.

The query cache stores the text of a SELECT statement together with the corresponding result that was sent to the client. If an identical statement is received later, the server retrieves the results from the query cache rather than parsing and executing the statement again.

Mysql query cache will not help you in this particular case.

Upvotes: 1

Related Questions