Best way to detect and then delete datastreams that have no observations? #1572
-
Hello all, I have a system which retains the latest 120 days of data. Each day, a cleanup process leverages the filtered delete feature to remove data older than 120 days. Over time, we have accumulated a number of datastreams which no longer have any observations - I call them "empty" datastreams - can anyone recommend a good way (API call perhaps, or some other recommended approach) to detect these "empty" datastreams? I would then launch a delete api call with the datastream's id to remove it from the frost db. Perhaps there is already a cleanup mechanism in FROST-Server to periodically remove such datastreams? Thanks for any input! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
My current idea is to launch a call like this one: |
Beta Was this translation helpful? Give feedback.
Yes,
$top=1
is faster than$count
. FROST-Manager has a cleanup tool that does:So instead of fetching individual Datastreams/Observations it fetches Datastreams and expands Observations. That way it only needs one call per Datastream-page. It then deletes the Datastreams with no Observations.
Can you check what the value is for the Datastream.phenomenonTime for those empty Datastreams? If the trigger works correctly, then that should be empty. That may be an…