What causes a history tag to be retired?

Sometimes when I have disabled, deleted or disabled history on a tag in the past, they get removed from the trend.
Not quite sure if there is a difference between:

  1. setting "tag->basic->enabled" to false
  2. setting "history->history enabled" to false
  3. deleting the tag.

Or if you do more than one of the above in different orders, it might lead to the tag not getting retired.

Lately i tried to remove tags and I found the retired column in sql_th to be null.
Had to manually enter a unix timestamp in the database for the deleted tag to disappear from the trend list.

What is the expected behavior here?

Currently on v8.1.30

Would be nice to know what actions keeps the trend data, and what actions will remove them.