Hi all Please look at the The query below select intAuditId,txtSchAuditeeEmpNo,txtSchAud1EmpNo,txtSchAud2EmpNo,txtSchSbAudEmpNo,txtProjectCode,dtScheduled from Accuser where datepart(month,dtScheduled) = 7 and datepart(year,dtScheduled) = 2003 and flgStatus = 'T' This is running very slow . There is only one clustered index on intAuditId. Non Clustered Index on flgStatus will not help because selectivity is poor Can the performance improve if I merge the datepart together for month and year?? Which function do I use ? [?]
In this query, the clustered index on the intAuditId column will not help. Try writing the query like select intAuditId,txtSchAuditeeEmpNo,txtSchAud1EmpNo,txtSchAud2EmpNo,txtSchSbAudEmpNo,txtProjectCode,dtScheduled from Accuser where dtScheduled >= '07/01/2003' and dtScheduled <= '07/31/2003' and flgStatus = 'T' and create non-clustered index on dtScheduled. See if this helps Gaurav
Did u use this query? BTW how many rows in the table are being retured? And how many total rows are present? Gaurav