# Sqlth\_te maintenance - retired tags

**URL:** <https://forum.inductiveautomation.com/t/sqlth-te-maintenance-retired-tags/60575>\
**Category:** Ignition\
**Tags:** database, ignition81\
**Created:** [June 9, 2022, 7:19pm UTC](https://forum.inductiveautomation.com/t/sqlth-te-maintenance-retired-tags/60575 "2022-06-09T19:19:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WPhan](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@WPhan](https://forum.inductiveautomation.com/u/WPhan)\
**Post date:** [June 9, 2022, 7:19pm UTC](https://forum.inductiveautomation.com/t/sqlth-te-maintenance-retired-tags/60575/1 "2022-06-09T19:19:24Z")

</div>

Hi all,

I was doing some reading in the [Ignition Database Table Reference](https://docs.inductiveautomation.com/display/DOC81/Ignition+Database+Table+Reference) and noticed that a tag can be retired for the following reasons.

> - The tag was deleted
> - The tag group on the tag was changed, which results in a new row being created with the updated `scid`
> - The tag was renamed

I ran a query to check how many of each I had.

```auto
SELECT count(*) FROM sqlth_te where retired IS NOT NULL 
~33000 tags
SELECT count(*) FROM sqlth_te where retired IS NULL 
~5000 tags

```

Looks like a lot of tags records can be deleted but I wanted to check to see if anyone has done this.

- Should I periodically delete records that have a retired value?
- Would I even gain anything by doing so?
- What are the downsides of doing so?
- Any other database tips I should be doing for this table or other Ignition tables?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 9, 2022, 7:27pm UTC](https://forum.inductiveautomation.com/t/sqlth-te-maintenance-retired-tags/60575/2 "2022-06-09T19:27:55Z")

</div>

Any historical data that had been stored prior to the tags being retired would no longer have a valid tagid. Generally if it is important that you keep historical data for a certain amount of time, I would recommend going through and updating the retired tagid’s with the new tagid’s prior to removing the retired tags.

You might see a small performance gain from shrinking the table size, and that would most likely be negligible. I don’t think there is anything else to gain.

I’m not sure of any other downsides to this.
