18 ms·
> So if you delete a tag, there is no way for the database to automatically remove all references to it. I'm not sure about implementation/support in Postgres
by a1369209993 4y ago
> So if you delete a tag, there is no way for the database to automatically remove all references to it.
I'm not sure about implementation/support in Postgres specifically, but in the general case of a column of tag bitfields, the database could easily maintain a global popcount (ie, "number of rows with this tag") and soft-delete flag for each tag, and clear any soft-deleted tags on (possibly-only-write-)access. When a soft-deleted tag reaches popcount == zero, it counts as garbage collected and can be reused for a new tag.