Deleted tags not retired in sqlth_te table

I am using the sqlth_te table for trending to select available tags that are configured to log to the DB. Problem is that i would have thought that the retired timestamp would designate the tags that were no longer logging. For some reason i have a lot of tags that have been deleted from project now that dont show a retired timestamp.

My question is one when are you updating the retired field? And what is the best option for resolving this in existing db?


Your idea is correct, deleted tags should get retired, but currently that value is only set when tags are updated. In other words, the system currently keeps one non-retired tag for each address, even if the tag no longer exists.

We have had the intention for a while to add various facilities for cleaning up tags that are no longer in use. Also, delete tags should probably be marked as retired automatically, with facilities for permanently removing them, or allowing them to still be visible.

In the mean time, you can mark tags as retired manually by setting a timestamp on that column, if you don’t want them to appear in the historical tag list. However, I would urge some caution with deleting from that table- if rows get deleted in error, it is virtually impossible to relink them with their data. So, make sure you have a backup of that table before you do anything.


Kind of what i was thinking. I will go in and set the retired fields on the ones that no longer exist for now.


Can all retired tags be deleted from sqlth_te? By doing so, will not loose any historical data, is nt it?