SQL查询优化--使用索引
查询条件使用not或者!=操作符时 案例需求:查看 Select * From PRODUCTION.WORKORDER Where ProductID!=732 的索引使用情况使用组合索引的效果案例需求:数据表PRODUCTION.WORKORDER建立两个组合索引: 索引1: IX_WorkOrder_ProductIDStartDateEndDate 包含三个字段(ProductID,StartDate,EndDate)索引2: IX_Workorder_StartdateEnddate包含字段 两个字段(StartDate,EndDate)查询结果字段与查询条件字段成对出现 案例需求:分析查询语句 Select ProductID From PRODUCTION.WORKORDER Where startdate >cast(‘2001-07-12’ As datetime) And startdate < cast(‘2001-07-14’ As datetime) 使用以下哪组索引? 索引1: IX_WorkOrder_ProductIDStartDateEndDate包含字段(ProductID,StartDate,EndDate) 索引2 : IX_Workorder_StartdateEnddate包含字段(StartDate,EndDate)
页:
[1]