I am trying to get historical alarm data. I'm doing it with the Alarm Journal Query (system.alarm.queryJournal) to avoid different syntaxes and compatibilities across varying databases. I am trying to get the Active, Acknowledged, and Cleared timestamps. However, these timestamps are spread across multiple events. I'm running into performance issues as I am trying to scale this up, for example:
- Get all the UUIDs for the time range (at least 30 days, which is could be easily thousands of events)
- Get a list of all the unique UUIDs (which is likely still thousands)
- Find all the events that match a specific UUID (which is generally 3: active, acknowledge, clear)
- Find all the timestamps from the events for my specific UUID
- Loop back to Item #3 until we step through all of our UUIDs and get all of our information (once again easily need to loop thousands of times because of Item #2)
Is there an easier or more efficient way of doing this?