Besides the non-deterministic function, the problem that I see is that you are doing calculations in a field. This (usually) makes any index in the field unusable in the query.
The second paragraph of this link ( Ten Common SQL Programming Errors (Indexed Column Functions in Predicates) ) provides more detailed information on when this happens, how to avoid it, and how sometimes optimizers can use indexes despite using functions.
In short, instead of relying on improved optimizers, you can often change the query by keeping the field intact (without any calculations on it), but instead making (inverse) calculations with different values. In your case, the current date provided by GetDate() . Then the query can use the index of the table1.Date field.
So you can use something like:
SELECT COUNT(*) FROM table1 WHERE table1.Date BETWEEN AND
And you only need to find the features that you will receive on the first and last day of the current month.
This blog post can help you: sql-server-query-to-find-first-and-last-day-of-current-month /
Even better, this StackOverflow question / answer: the easiest way to create-a-date-that-is-the-first-day-of-the-month-Given-other-date
I will need to check, but I think this small change above will be:
SELECT COUNT(*) FROM table1 WHERE table1.Date >= DATEADD(mm, DATEDIFF(mm, 0, GetDate() ), 0) AND table1.Date < DATEADD(mm, 1 + DATEDIFF(mm, 0, GetDate() ), 0)