What I'm trying to achieve is to only keep the latest of any given point identified by an ID, delete everything else.
The ID is a tag.
So let's say we have:
time ID ...
2022-06-28 18:29:00 id1 ...
2022-06-28 18:28:00 id1 ...
2022-06-28 18:27:00 id1 ...
2022-06-28 18:29:00 id2 ...
2022-06-28 18:28:00 id2 ...
2022-06-28 18:29:00 id3 ...
Would result to:
time ID ...
2022-06-28 18:29:00 id1 ...
2022-06-28 18:29:00 id2 ...
2022-06-28 18:29:00 id3 ...
Is that possible without having to do something like:
DELETE FROM "measurement" WHERE "ID" = '...' AND time < ...
Which take way too much time to execute on all possible "duplicates". You can't also have any OR
in a delete where statement. Multiple statements like specified here also take too long to execute.