I have the following table structure.
Now I am using the following query
SELECT DATE(date),SUM(amount) FROM my_table WHERE type!=5
AND date BETWEEN '2014-01-01' AND '2014-01-04'
GROUP BY DATE(date) ORDER BY date DESC
This query is working on my development database which only has small number of rows. But this is very slow with the prod database and is taking almost 9 seconds to display the values for a week. I have indexes for date and type and my explain query is showing type as all. The prod DB almost has 700000 entries there.
How can I optimize this query further ??