从视图中选择*需要4分钟
我遇到一个问题,当我针对视图运行查询时,它需要4分钟以上的时间。但是,当我运行查询的内容时,它会在大约1秒钟内完成。 我唯一不确定的是要联接的表都是临时表。 临时查询计划:https : //www.brentozar.com/pastetheplan/?id=BykohB2p4 查看查询计划:https : //www.brentozar.com/pastetheplan/?id=SkIfTHh6E 关于在哪里尝试找出答案的任何建议? 查看代码: ALTER VIEW [dbo].[vwDealHistoryPITA] AS SELECT ROW_NUMBER() OVER (PARTITION BY cm.CodeMasterID ORDER BY cm.CodeMasterID, cm.LastUpdateDate) AS Deal_HistoryID, cm.CodeMasterID, cm.ProjectName, cm.[Status], d.CompanyID, d.DealTypeMasterID, cm.[Description], d.PassiveInd, d.ApproxTPGOwnership, d.NumberBoardSeats, d.FollowonInvestmentInd, d.SocialImpactInd, d.EquityInd, d.DebtInd, d.RealEstateInd, d.TargetPctgReturn, d.ApproxTotalDealSize, cm.CurrencyCode, d.ConflictCheck, cm.CreatedDate, cm.CreatedBy, cm.LastUpdateDate, cm.LastUpdateBy, d.ExpensesExceedThresholdDate, d.CurrentTPGCheckSize, …