I tried this:
use northwind
go
SELECT OrderDate
FROM Orders WHERE OrderDate > '19950101'
see the query plan? ok
SELECT OrderDate, EmployeeId
FROM Orders WHERE OrderDate > '19950101'
see the query plan? what appened?
the only way to make an index seek instead of an index scan is to
force the
index usage ( with(index=orde rdate) ), but I don't like this solution
also try this:
SELECT *
FROM Orders WHERE employeeId > 9
and
SELECT *
FROM Orders WHERE employeeId > 8
Can someone explain why this appens? and how can I overturn the
performance loss problem (well not in orders table, but in my table
there are 300K records and making a scan to retrieve 50 records is not
exactly what I want)
thanks to all
use northwind
go
SELECT OrderDate
FROM Orders WHERE OrderDate > '19950101'
see the query plan? ok
SELECT OrderDate, EmployeeId
FROM Orders WHERE OrderDate > '19950101'
see the query plan? what appened?
the only way to make an index seek instead of an index scan is to
force the
index usage ( with(index=orde rdate) ), but I don't like this solution
also try this:
SELECT *
FROM Orders WHERE employeeId > 9
and
SELECT *
FROM Orders WHERE employeeId > 8
Can someone explain why this appens? and how can I overturn the
performance loss problem (well not in orders table, but in my table
there are 300K records and making a scan to retrieve 50 records is not
exactly what I want)
thanks to all
Comment