根据MSDN,
Table Spool操作符扫描输入并将每行的副本放在隐藏的假脱机表中,该表存储在tempdb数据库中,并且仅在查询的生命周期中存在。
首先,在此步骤之前计划中没有任何输入...此文本表明它应该和other resources在线已经说了很多。
假脱机操作员始终与其他操作员一起使用。在存储值时,它需要知道这些值是什么,因此它必须从另一个运算符接收它们。
其次,当鼠标悬停时的输出列表包含多个表时。他们都被假脱机到个人桌子吗?如果是这样,为什么不显示多个步骤?如果他们都假脱机到一张桌子,他们是否在假脱机之前加入?如果你愿意,可以在表格中“展平”。
第三,正如我在下面解释的那样,我认为我有1和2的答案......但现在我看到原始步骤的成本百分比是0%,并且当该线轴在另一个分支中重复使用时,成本%是12 %。为什么阅读它的成本会超过原来的写作?
编辑:文本计划
StmtText
|--Compute Scalar(DEFINE:([so].[SLS_ORG_OPR_UNT_SRC_KEY]=[Expr1021], [so].[SLS_ORG_PROD_SRC_KEY]=[Expr1022], [cal].[WEEK_END_DATE]=[Expr1023], [so].[SLS_ORG_EMPL_SRC_KEY]=[Expr1024], [so].[SLS_ORG_JOBCODE]=[Expr1025]))
|--Hash Match(Inner Join, HASH:([Expr1021], [Expr1022], [Expr1023], [Expr1024], [Expr1025])=([Expr1016], [Expr1017], [Expr1018], [Expr1019], [Expr1020]), RESIDUAL:([Expr1016] = [Expr1021] AND [Expr1017] = [Expr1022] AND [Expr1018] = [Expr1023] AND [Expr1019] = [Expr1024] AND [Expr1020] = [Expr1025]))
|--Compute Scalar(DEFINE:([Expr1021]=[DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_OPR_UNT_SRC_KEY] as [so].[SLS_ORG_OPR_UNT_SRC_KEY], [Expr1022]=[DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_PROD_SRC_KEY] as [so].[SLS_ORG_PROD_SRC_KEY], [Expr1023]=[DMRPT].[dbo].[DIM_CALENDAR].[WEEK_END_DATE] as [cal].[WEEK_END_DATE], [Expr1024]=[DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_EMPL_SRC_KEY] as [so].[SLS_ORG_EMPL_SRC_KEY], [Expr1025]=[DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_JOBCODE] as [so].[SLS_ORG_JOBCODE]))
| |--Compute Scalar(DEFINE:([Expr1011]=CONVERT_IMPLICIT(int,[Expr1059],0)))
| |--Stream Aggregate(GROUP BY:([so].[SLS_ORG_OPR_UNT_SRC_KEY], [so].[SLS_ORG_PROD_SRC_KEY], [cal].[WEEK_END_DATE], [so].[SLS_ORG_EMPL_SRC_KEY], [so].[SLS_ORG_JOBCODE]) DEFINE:([Expr1059]=COUNT([Expr1015])))
| |--Sort(DISTINCT ORDER BY:([so].[SLS_ORG_OPR_UNT_SRC_KEY] ASC, [so].[SLS_ORG_PROD_SRC_KEY] ASC, [cal].[WEEK_END_DATE] ASC, [so].[SLS_ORG_EMPL_SRC_KEY] ASC, [so].[SLS_ORG_JOBCODE] ASC, [Expr1015] ASC))
| |--Table Spool
| |--Compute Scalar(DEFINE:([Expr1015]=[Expr1013]+[Expr1014]))
| |--Hash Match(Inner Join, HASH:([so].[SLS_ORG_GK])=([f].[SLS_ORG_GK]), RESIDUAL:([DMRPT].[dbo].[FACT_PRODUCER_SPREAD_HOURS].[SLS_ORG_GK] as [f].[SLS_ORG_GK]=[DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_GK] as [so].[SLS_ORG_GK]))
| |--Clustered Index Scan(OBJECT:([DMRPT].[dbo].[DIM_SALES_ORG].[SYS_SLS_ORG_GK] AS [so]))
| |--Hash Match(Inner Join, HASH:([c].[CONTR_GK])=([f].[CONTR_GK]), RESIDUAL:([DMRPT].[dbo].[FACT_PRODUCER_SPREAD_HOURS].[CONTR_GK] as [f].[CONTR_GK]=[DMRPT].[dbo].[DIM_CONTRACTOR].[CONTR_GK] as [c].[CONTR_GK]))
| |--Compute Scalar(DEFINE:([Expr1014]=CONVERT_IMPLICIT(numeric(38,0),[DMRPT].[dbo].[DIM_CONTRACTOR].[CONTR_SRC_KEY] as [c].[CONTR_SRC_KEY],0)))
| | |--Index Scan(OBJECT:([DMRPT].[dbo].[DIM_CONTRACTOR].[nc_csk] AS [c]))
| |--Hash Match(Inner Join, HASH:([r].[REQ_POS_GK])=([f].[REQ_POS_GK]), RESIDUAL:([DMRPT].[dbo].[FACT_PRODUCER_SPREAD_HOURS].[REQ_POS_GK] as [f].[REQ_POS_GK]=[DMRPT].[dbo].[DIM_REQUISITION_POS].[REQ_POS_GK] as [r].[REQ_POS_GK]))
| |--Compute Scalar(DEFINE:([Expr1013]=CONVERT_IMPLICIT(numeric(38,0),[DMRPT].[dbo].[DIM_REQUISITION_POS].[REQ_POS_JOB_REQ_SRC_KEY] as [r].[REQ_POS_JOB_REQ_SRC_KEY],0)+[DMRPT].[dbo].[DIM_REQUISITION_POS].[REQ_POS_POSITION_NO] as [r].[REQ_POS_POSITION_NO]))
| | |--Clustered Index Scan(OBJECT:([DMRPT].[dbo].[DIM_REQUISITION_POS].[SYS_C00600262] AS [r]))
| |--Hash Match(Inner Join, HASH:([cal].[DATE_GK])=([f].[WEEK_END_DATE_GK]), RESIDUAL:([DMRPT].[dbo].[FACT_PRODUCER_SPREAD_HOURS].[WEEK_END_DATE_GK] as [f].[WEEK_END_DATE_GK]=[DMRPT].[dbo].[DIM_CALENDAR].[DATE_GK] as [cal].[DATE_GK]))
| |--Clustered Index Scan(OBJECT:([DMRPT].[dbo].[DIM_CALENDAR].[SYS_C00599872] AS [cal]), WHERE:([DMRPT].[dbo].[DIM_CALENDAR].[FULL_DATE] as [cal].[FULL_DATE]>=getdate()-'1900-01-31 00:00:00.000'))
| |--Clustered Index Scan(OBJECT:([DMRPT].[dbo].[FACT_PRODUCER_SPREAD_HOURS].[PK_FCT_PRDCR_SPRD_HRS] AS [f]))
|--Compute Scalar(DEFINE:([Expr1016]=[DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_OPR_UNT_SRC_KEY] as [so].[SLS_ORG_OPR_UNT_SRC_KEY], [Expr1017]=[DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_PROD_SRC_KEY] as [so].[SLS_ORG_PROD_SRC_KEY], [Expr1018]=[DMRPT].[dbo].[DIM_CALENDAR].[WEEK_END_DATE] as [cal].[WEEK_END_DATE], [Expr1019]=[DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_EMPL_SRC_KEY] as [so].[SLS_ORG_EMPL_SRC_KEY], [Expr1020]=[DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_JOBCODE] as [so].[SLS_ORG_JOBCODE]))
|--Hash Match(Aggregate, HASH:([so].[SLS_ORG_OPR_UNT_SRC_KEY], [so].[SLS_ORG_PROD_SRC_KEY], [cal].[WEEK_END_DATE], [so].[SLS_ORG_EMPL_SRC_KEY], [so].[SLS_ORG_JOBCODE]), RESIDUAL:([DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_OPR_UNT_SRC_KEY] as [so].[SLS_ORG_OPR_UNT_SRC_KEY] = [DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_OPR_UNT_SRC_KEY] as [so].[SLS_ORG_OPR_UNT_SRC_KEY] AND [DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_PROD_SRC_KEY] as [so].[SLS_ORG_PROD_SRC_KEY] = [DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_PROD_SRC_KEY] as [so].[SLS_ORG_PROD_SRC_KEY] AND [DMRPT].[dbo].[DIM_CALENDAR].[WEEK_END_DATE] as [cal].[WEEK_END_DATE] = [DMRPT].[dbo].[DIM_CALENDAR].[WEEK_END_DATE] as [cal].[WEEK_END_DATE] AND [DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_EMPL_SRC_KEY] as [so].[SLS_ORG_EMPL_SRC_KEY] = [DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_EMPL_SRC_KEY] as [so].[SLS_ORG_EMPL_SRC_KEY] AND [DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_JOBCODE] as [so].[SLS_ORG_JOBCODE] = [DMRPT].[dbo].[DIM_SALES_ORG].[SLS_ORG_JOBCODE] as [so].[SLS_ORG_JOBCODE]) DEFINE:([Expr1010]=SUM([DMRPT].[dbo].[FACT_PRODUCER_SPREAD_HOURS].[SPREAD_LCL] as [f].[SPREAD_LCL])))
|--Table Spool
答案 0 :(得分:1)
好的我发现,如果您在计划中看到该操作以查找其他位置here。
因此写出计划的一个分支的结果,并在另一个分支中再次使用临时表。所以现在我看到了源代码,我看到了前辈/输入,看到它已经将表连接在一起并且正在假脱机连接的行。