程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> select-sql 語句優化,求幫忙

select-sql 語句優化,求幫忙

編輯:編程綜合問答
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很高,導致系統速度慢

最佳回答:


你那個算法太多了,能不能精簡一下

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved