日期:2014-05-17 浏览次数:20537 次
--打开"包含实际的执行计划" Ctrl + M
SET STATISTICS IO, TIME ON
--看一下两次执行的执行计划,分析一下原因。
--从你的描述看,不应该有这么大的性能差别。改成下面的试试:
CREATE VIEW xxx
AS
SELECT *
FROM Product_Info a
INNER JOIN Product_Type j
ON a.TypeID = j.ProductTypeID
INNER JOIN Product_Spec b
ON a.ProductId = b.ProductId
AND b.Status = '0'
LEFT JOIN v_f_product_info_property i
ON a.ProductID = i.[product_info_mainid]
LEFT JOIN Shop_Cabinet h
ON b.ProductspecID = h.ProductspecID
LEFT JOIN Product_Spec_property g
ON b.ProductspecID = g.MainID
GO
SET STATISTICS IO, TIME ON
SELECT * FROM xxx WHERE ProductTypeID = 39
--还是看一下IO,TIME都消耗在哪儿了;看一下执行计划,是否有问题