I have a very simple select statement:
SELECT COUNT(*) as varTotal
WHERE stat_account = 173
BETWEEN '2012-11-01 00:00:00'
AND '2012-12-01 00:00:00'
It's running on a table that has 36 Million records. I'd like to it be faster.
I have two indexes setup, one on stat_account and one on stat_created.
So first of all, is there something I should do to make the query faster? Like maybe COUNT(*) isn't a good idea, or there something better than BETWEEN?
And secondly, should I change my indexes? Make a combo index that includes account and created?
Or maybe you have another idea?