I need to get the number of orders per day (the βtimeβ field is the java timestamp, and the βorderβ table has 1,000,000 entries ), I use:
select count(*) from `order` where `time`>1307894400000 && `time`<1307980799999
this sql used 540 ms
I tried to create a time index using field, but still needed 390ms
How can I optimize this sql statement?
source
share