I'm doing some work on future dates and I need to use this statement -
select ddate from testdate where ddate = DATE_ADD(NOW(),INTERVAL 8 DAY) or ddate = DATE_ADD(NOW(),INTERVAL 4 DAY)
ddate is a date field added when the rec was created and is x number of days into the future.
Explain select for the above select gives the type as range, which is only just good.
A single select -
select ddate2 from testdate where ddate2 = DATE_ADD(NOW(),INTERVAL 30 DAY)
gives an explain select type as ref, which is better.
My question -
Would it be quicker on a large data set to use the double 'or' select, or would it be quicker to use two separate selects ie,
select ddate2 from testdate where ddate2 = DATE_ADD(NOW(),INTERVAL 8 DAY)
select ddate2 from testdate where ddate2 = DATE_ADD(NOW(),INTERVAL 4 DAY)
thanks
Bob
select ddate from testdate where ddate = DATE_ADD(NOW(),INTERVAL 8 DAY) or ddate = DATE_ADD(NOW(),INTERVAL 4 DAY)
ddate is a date field added when the rec was created and is x number of days into the future.
Explain select for the above select gives the type as range, which is only just good.
A single select -
select ddate2 from testdate where ddate2 = DATE_ADD(NOW(),INTERVAL 30 DAY)
gives an explain select type as ref, which is better.
My question -
Would it be quicker on a large data set to use the double 'or' select, or would it be quicker to use two separate selects ie,
select ddate2 from testdate where ddate2 = DATE_ADD(NOW(),INTERVAL 8 DAY)
select ddate2 from testdate where ddate2 = DATE_ADD(NOW(),INTERVAL 4 DAY)
thanks
Bob