When to use SQL_NO_CACHE

后端 未结 4 1884
终归单人心
终归单人心 2020-12-13 05:20

I am in the process of going over my queries, and I have been reading articles about how you should use SQL_NO_CACHE in SELECT queries. This has co

4条回答
  •  感动是毒
    2020-12-13 05:35

    In order to answer you question you first have to understand how the MySQL query cache works. A very good article about this can be found here. On of the key aspects is that the cache is synchronized with the data:

    The query cache does not return stale data. When tables are modified, any relevant entries in the query cache are flushed.

    In your usecases I don't find any real purpose for not using the query cache with SQL_NO_CACHE. There are reasons like profiling or avoiding writing big data into a limited query cache for using this option, but I don't see this to be the case here.

提交回复
热议问题