SQL Server性能调优杂记(四)
2008-12-08 10:15:13 来源:WEB开发网虽然冗长,但是基本结构很清晰,就是如果当用主关键字查询,后面一大堆就不起什么作用。系统的速度和聚集索引有关系。
把语句改造一下,
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)))
- ››sql server自动生成批量执行SQL脚本的批处理
- ››sql server 2008亿万数据性能优化
- ››SQL Server 2008清空数据库日志方法
- ››sqlserver安装和简单的使用
- ››SQL Sever 2008 R2 数据库管理
- ››SQL SERVER无法安装成功,sqlstp.log文件提示[未发...
- ››Sql Server中通过父记录查找出所有关联的子记录
- ››SqlServer触发器、存储过程和函数
- ››SQL Server 中的事务(含义,属性,管理)
- ››Sqlite数据库插入和读取图片数据
- ››Sql server 2005拒绝了对对象 'xx表' (数...
- ››Sql server 2005拒绝了对对象 'xx表' (数...
更多精彩
赞助商链接