I have a table that stores time-series (5-minute) data and am trying to run a query that has a BETWEEN clause included in it. Below is the table structure:-
Timestamp | ComponenentID | Parameter1 | Parameter2 | Parameter3
The table has an index on ComponentId and also a Clustered Columnstore index (Azure S3 and above get this feature).
The query I am trying to run:-
SELECT * FROM table WHERE Timestamp BETWEEN '2020-01-01' AND '2020-01-02'
I am looping through multiple similar tables to fetch data and sometimes it takes about 30 seconds to get one day worth of data. Is there anything I can do to reduce this time?