I have a table with a date index StartDate. I'm just wondering how, at the stage of query optimization, requests of the following type are processed:
SELECT *
FROM <dbo.TABLE>
WHERE (StartDate BETWEEN '2010-01-01' AND '2010-01-10')
OR (StartDate BETWEEN '2010-01-05' AND '2010-01-15')
There is overlap between the two dates. Should I do the optimization myself, giving her dates how (StartDate BETWEEN '2010-01-01' AND '2010-01-15')or can the SQL engine optimize it myself?
source
share