I have a table named MetricTbl with fields as User_Id, Entity, Metric, ModifiedDate, Value. Value, UserId are integer. Entity and Metric are nvarchar. Table has around 30 million rows.
I want to optimize the query - select SUM(Value) from MetricTbl where UserId = 1 and Entity = 'Room' and Metric = 'Temperature'
I have to design a strategy for this kind of query. I am using azure federation. And this is a federated table. I already created unique index on User_Id, Entity, Metric, ModifiedDate. Since it is azure federation so I cant have indexed views. Please suggest some strategy. If there is need I am allowed to create new table. Thanks Manish