I have a piece of code that is selecting based on dates, using an IQueryable. The sql performance here is causing timeouts. If this was straight SQL, I'd using (OPTIMIZE FOR (@date UNKNOWN). However, with
DateTime now = DateTime.UTC Now;
var results = from item in items.Find()
where item.startDate <= now
where item.endDate > now
select item;
return results;
Is there a good way to add this hint? Or should I move this to the database as a stored procedure?