在显示大量数据时提高网页性能

时间:2015-08-06 12:13:50

标签: sql-server

我有一个ms SQL查询,它填充了我网页上的网格视图。因为查询从链接服务器(oracle数据库)中提取数据,所以我发现性能非常差。

到目前为止,我试图加速它的事情是;

  • 仅选择所需的字段。
  • 从视图中获取数据而不是使用子查询。
  • 不使用where子句中的任何或者。
  • 在我的观点中,我使用了OPENQUERY(数据库,“sql语句”)来获取我需要的数据。

我不能做的一件事是从链接服务器表中提取数据并使用sql server作业在本地存储。

无论如何,我可以在我的网页代码背后加速吗?

sql是;

SELECT DISTINCT  
    stk_Products.stk_ItemNo AS code, com_stock.STK_PRO_CODE AS Barcode, stk_Products.stk_ItemDescription AS Description,  
    com_product.PRO_ADD_INFO_1 AS packsize, STOCK_CONTROL_FILE.OVERALL_STOCK_LEVEL, com_stock.STK_EXPIRY_DATE AS ExpiryDate,  
    com_stock.STK_PRODN_DATE AS PromoDate, com_stock.STK_QTY AS Quantity, com_stock.STK_STATUS AS Status, com_stock.STK_DATE_REC AS DateReceived,  
    com_stock.STK_LOC_ID, com_stock.STK_ZON_ID, STOCK_CONTROL_FILE.QTY_ALLOCATED, STOCK_CONTROL_FILE.AvgWkSales8,  
    stk_ProductGroupSuperReportingDivision.sup_Description 
    FROM       vw_locator_PRODUCT AS com_product INNER JOIN 
        vw_locator_STOCK AS com_stock ON 
    com_product.PRO_CODE = com_stock.STK_PRO_CODE RIGHT OUTER JOIN 
    stk_Products INNER JOIN 
    stk_ProductGroup ON stk_Products.stk_ProductGroup = stk_ProductGroup.stk_ProductGroup INNER JOIN 
    stk_ProductGroupReportingDivision ON stk_ProductGroup.stk_ReportingDivision = stk_ProductGroupReportingDivision.rep_ID INNER JOIN 
    stk_ProductGroupSuperReportingDivision ON stk_ProductGroupReportingDivision.rep_SuperDivision = stk_ProductGroupSuperReportingDivision.sup_ID INNER JOIN 
    STOCK_CONTROL_FILE ON stk_Products.stk_ItemNo = STOCK_CONTROL_FILE.ITEM_NUMBER ON  
    com_stock.STK_PRO_CODE = STOCK_CONTROL_FILE.SUPPLIERS_ITEM_NUMBER COLLATE DATABASE_DEFAULT
    WHERE        (stk_ProductGroupSuperReportingDivision.sup_Description = @division) AND (com_stock.STK_EXPIRY_DATE <= @date)

0 个答案:

没有答案