Aggregate all tag values for same timestamp

Schema overview:

performance, device=device1, source=source1, resultIndex=0 score=20 1465839830100400200
| ----------------------------------------------------------------------------------  |
|            |                                              |       |                 |
|            |                                              |       |                 |
+-----------+-+--------------------------------------------+-+-----+-+----------------+
|measurement |,                tag_set                     |field_set|    timestamp   |
+-----------+-+--------------------------------------------+-+-----+-+----------------+

Sample data:
performance,device=device1, source=source1, resultIndex=0 score=20 1465839830100400200
performance,device=device1, source=source1, resultIndex=1 score=30 1465839830100400200
performance,device=device1, source=source2, resultIndex=0 score=50 1465839830100400200
performance,device=device1, source=source2, resultIndex=1 score=60 1465839830100400200

The measurement has multiple data points for the same timestamp but the tagset values are unique, which means the data won’t get overwritten.

Question: How can I aggregate score of all data points for a given timestamp and device? Do I still need to use GROUP BY with a really small time interval, like 1ms. Or is there a more sophisticated way?

Yeah, I believe you will need to do the GROUP BY as you’ve suggested. If this is a common task, you could use continous queries or Kapacitor to automate the calculation.