【问题标题】:SQL Server Execution Plans - Actual vs. EstimatedSQL Server 执行计划 - 实际与估计
【发布时间】:2011-04-06 22:16:28
【问题描述】:

我正在阅读 Grant Fritchey 的优秀著作,SQL Server Execution Plans。在第 页。 21 他说,"When a query is submitted to the server, an estimated execution plan is created by the optimizer. Once that plan is created, and before it gets passed to the storage engine, the optimizer compares this estimated plan to the actual execution plan that already exist in the plan cache." 他接着说这样做是因为生成查询计划的成本很高。

这听起来像 SQL Sever 将由优化器计算一个估计的计划,如果估计的计划与计划缓存中的实际计划不匹配,则创建一个实际计划并将其存储在缓存中。所以,听起来好像计划缓存中是否存在现有计划,SQL Server 总是会生成一个估计的计划。如果它无论如何都要这样做,为什么还要在缓存中存储任何东西呢?为什么不总是计算一个计划,因为它至少会做一次呢?我错过了什么吗?

谢谢。

【问题讨论】:

    标签: sql-server optimization query-optimization


    【解决方案1】:

    我会读 this 更准确,恕我直言

    格兰特也接受here

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-18
    • 1970-01-01
    • 2019-03-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多