Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-12224

Keep tags' ref_count and aggregate vote counts updated with triggers

XMLWordPrintable

      Currently tag.ref_count isn't updated at all, and hasn't been used for years.  The idea of dropping it has been floated, but I can see a use for it in the tag cloud at least, and in any future code that needs a way to quickly sort tags/genres by popularity.  So I propose keeping this column updated via triggers on the raw tag tables.  To be clear, this would be a reference count: a count of all the times the tag is referenced at all, whether by upvote or downvote.

      The count column on the aggregate tag tables (e.g. area_tag.count) is a sum of all the votes for that entity-tag pair.  (Upvotes count as +1 vote, downvotes as -1.)  We currently update this column manually in Perl (see Data::EntityTag), but many of the existing values are out of sync (see MBS-5359 for one example of why); they'd be much more reliable if updated via triggers, and this would make features like MBS-960 easier to implement.

            bitmap Michael Wiencek
            bitmap Michael Wiencek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Version Package
                Schema change, 2022 Q2