冷丁_ 2022-10-25 21:15 采纳率: 33.3%
浏览 19
已结题

为什么表更新时要清空查询缓存

为什么表更新时要清空查询缓存
为什么表更新时要清空查询缓存
为什么表更新时要清空查询缓存
为什么表更新时要清空查询缓存

  • 写回答

1条回答 默认 最新

  • Shi Er Ge 2022-10-26 11:21
    关注

    这是因为 MySQL 自带的缓存机制,将查询结果进行缓存,如果 table 数据未发生变化,再次使用同一条 SQL 进行查询时,直接从上次的查询结果缓存中读取数据,而不是重新分析、执行 SQL。

    如果 table 数据发生变化,所有与之相关的缓存都会被释放刷新,这样就不会出现数据脏读问题。
    

    The query cache stores the text of a SELECT statement together with the corresponding result that was sent to the client. If an i dentical statement is received later, the server retrieves the results from the query cache rather than parsing and executing the statement again. The query cache is shared among sessions, so a result set generated by one client can be sent in response to the same query issued by another client.

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 11月6日
  • 已采纳回答 10月29日
  • 创建了问题 10月25日