kpeng163 2015-04-27 08:44 采纳率: 90.9%
浏览 1435
已采纳

sql 语句优化,求帮忙

Select t9.Product_ID,a.Product_Name,a.Product_BuyNum, b.Org_Price, b.Sale_Price, c.Img_Small, c.Img_Middle,
isnull((select SubShop_Price from subshop_product where subshop_id=1057 and product_id=a.product_id),b.Sug_Price) as SubShop_Price, b.Sug_Price,a.Product_SeeNum,a.AddTime,
a.orderid From
(
Select Top 30 product_id from
(
Select row_number() over(order by a.product_id desc) as rownumber,a.product_id

From Product_Info a
Inner Join Product_Price b On a.Product_ID = b.Product_ID

Inner Join SubShop_ProductRight d ON a.Class_ID = d.Class_ID AND d.SubShop_ID=1057

Where ((a.SubShop_ID is null or a.SubShop_ID=-1) or ((a.SubShop_ID=1057 or a.Is_AllShow=0 ) and Is_Audit=0))
and a.IsHidden = 0 And a.IsDelete = 0
And a.Product_Name Like '%%' and a.Product_ID
not in (select product_id from SubShop_Product where IsHidden=1 and SubShop_ID=1057)

) t
where rownumber>4170 Order By rownumber
) as t9
inner join Product_Info a on a.Product_ID=t9.Product_ID
Inner Join Product_Price b On a.Product_ID = b.Product_ID left Join Product_Detail c On a.Product_ID = c.Product_ID

rownumber>4170 这个数值会根据不同页数变化,求解怎么优化,这个占用CPU很高,导致系统速度慢

  • 写回答

4条回答 默认 最新

  • caoqunlin 2015-04-27 09:40
    关注

    你那个算法太多了,能不能精简一下

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?