WEB开发网
开发学院数据库MSSQL Server SQL Server性能调优杂记(四) 阅读

SQL Server性能调优杂记(四)

 2008-12-08 10:15:13 来源:WEB开发网   
核心提示: 虽然冗长,但是基本结构很清晰,SQL Server性能调优杂记(四)(2),就是如果当用主关键字查询,后面一大堆就不起什么作用,系统的速度和聚集索引有关系,把语句改造一下

虽然冗长,但是基本结构很清晰,就是如果当用主关键字查询,后面一大堆就不起什么作用。系统的速度和聚集索引有关系。

把语句改造一下,

SELECT   a.AWB_NO,
        a.BWB_NO,
        a.CWB_NO,
        a.ORIGIN,
        a.DEST,
        a.MODIFY_ON,
        a.CREATED_ON,
        a.CONSIGNOR_CUSTOMER_CODE,
        a.CONSIGNOR_CODE, 
        a.CONSIGNOR_NAME,
        a.CONSIGNEE_NAME,
        a.CWB_STATUS,
        a.CWB_TYPE,
        ISNULL(a.PCS, 0) AS PCS,
        a.BWBLIST,
        b.PWEIGHT  
  FROM    TB_CWB AS a
  LEFT JOIN  TB_CWBWEIGHT AS b
  ON      a.CWB_NO = b.CWB_NO
  AND      b.AVAILABLE = 'Y' 
  WHERE    a.AVAILABLE = 'Y'
  AND      (a.CWB_NO = '31017768390' OR
                                     (( '31010930775' IS NULL)
  AND      (a.AWB_NO = NULL OR NULL IS NULL)
  AND      (a.BWB_NO = NULL OR NULL IS NULL)
  AND      (a.IE_TYPE = NULL OR NULL IS NULL)
  AND      (a.CREATED_ON >= NULL OR NULL IS NULL)
  AND      (a.CREATED_ON <= NULL OR NULL IS NULL)
  AND      (a.PAYMENT = NULL OR NULL IS NULL)
  AND      (a.ORIGIN = NULL OR NULL IS NULL)
  AND      (a.DEST = NULL OR NULL IS NULL)
  AND      (a.CONSIGNOR_CUSTOMER_CODE = NULL OR NULL IS NULL)
  AND      (a.CONSIGNOR_NAME LIKE '%' + NULL + '%' OR NULL IS NULL)
  AND      (a.CONSIGNEE_NAME LIKE '%' + NULL + '%' OR NULL IS NULL)
  AND      (a.CWB_TYPE = NULL OR NULL IS NULL)))

上一页  1 2 3 4  下一页

Tags:SQL Server 性能

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接