The table has 4 columns of type datetime, smallint(6), tinyint(4) and decimal(15,5). The first 3 columns are PK. There are four indexes on the table: one with all the PK columns, and one with each column separately. The table has ~50 Million rows and grows rapidly, the plan is to keep it under 100 million rows by archiving the oldest data. Reports based on various datetime ranges and other combinations of the PK columns are run on it frequently, but these reports have begun to take too long. Around 5 minutes to return 10 records.
Column Names
DateTimeStamp--DateTime------PK,NN
SystemNumber--SmallInt(6)------PK,NN
DataNumber------TinyInt(4)-------PK, NN
Value---------------Decimal(15, 5)
Indexes
Primary-------------------BTREE-Unique---DateTimeStamp, DataNumber, SystemNumber, value
DateTimeIDX------------BTREE-Non Unique--DateTimeStamp
DataNumber-------------BTREE-Non Unique---DataNumber
SystemNumberIDX----BTREE--Non Unique---SystemNumber
Select DateTimeStamp, Value
From SystemStats
WHERE DataType=16
AND DateTimeStamp >='" & StartDate & "'
and DateTimeStamp <= '" & EndDate & "'
and SystemNumber =" & mVars.SystemNumber & "
Order by DateTimeStamp;
My Question
How would you change the index on the table to speed up queries?