Mayur  Gujrathi

Mayur Gujrathi

  • 409
  • 3.9k
  • 1m

SQL query execution timings

Aug 4 2016 8:28 AM
I am not getting the reason why query 1 is taking 10 seconds,query 2 and query 3 taking 1 second to execute even if they are same only order is different
 
1.SELECT TOP 10000 * FROM tbl1
WHERE
len(empid) = 4 and
isnumeric(empid) = 1   ORDER BY empid desc
2.SELECT TOP 10000 * FROM tbl1
WHERE
len(Employee_ID) = 4 and
isnumeric(empid) = 1 
 
3.SELECT TOP 10000 * FROM tbl1
WHERE
len(empid) = 4 and
isnumeric(empid) = 1 ORDER BY empid
 

Answers (5)