Is this phase of query optimization considered?

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?

+5
source share
1 answer

Compare this to variables and constants: plans should be different.

SQL Server , . , . , " " , , ,

"" , end < start, .

,

Forced Parameterization", .

+5

All Articles