2010-09-01 55 views
2

我正在阅读Grant Fritchey的优秀书籍SQL Server Execution Plans。在第pg。 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 Server执行计划 - 实际与预计

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

谢谢。

回答

1

我读到this哪个更准确,恕我直言,

格兰特的看法是here

+0

https://www.simple-talk.com/sql/performance/graphical-execution-plans-for - 简单-SQL查询/ – 2017-03-16 11:54:51