My DB has 7M records with 30+ variables, the below query is to filter data based on daily basis which takes me around approximately 12 mins to return the results
select customername, productname from xyztable where (datatime between '2019-05-17 00:00:00.000'
and '2019-05-18 00:00:00.000')
The same data I am also in need to filter it based on hourly basis as below,
select customername, productname from xyztable where (datatime between '2019-05-17 00:00:00.000'
and '2019-05-17 01:00:00.000')
I was expecting query result to be quicker on hourly basis since the data will be very less. But it takes the same time as that of daily basis.
So basically both hourly and daily basis query take 12 mins to return the result.
Is there anyway I could make the hourly result return much quicker than that of daily basis?