SqlServer 索引

BranchInfo 表索引设置
SqlServer  索引

--表扫描,索引无效
SELECT * FROM dbo.BranchInfo WHERE LEN(PoiId)>0

--索引扫描
SELECT * FROM dbo.BranchInfo WHERE PoiId<>''

--索引扫描
SELECT * FROM dbo.BranchInfo WHERE PoiId IS NOT NULL AND PoiId<>''

--表扫描,索引无效
SELECT * FROM dbo.BranchInfo WHERE PoiId IS NULL OR PoiId=''

--索引扫描
SELECT * FROM dbo.BranchInfo WHERE ISNULL(PoiId,'')<>''

--表扫描,索引无效
SELECT * FROM dbo.BranchInfo WHERE PoiId IS NULL
UNION
--索引扫描
SELECT * FROM dbo.BranchInfo WHERE PoiId =''

SqlServer执行计划
SqlServer  索引
SqlServer  索引

上一篇:SqlServer(索引)--创建复合索引时,复合索引列顺序对查询的性能影响[转]


下一篇:SqlServer基础--Select *与Select 指定列的区别