Artist_credit and artist_credit_name in database schema

Hi all,

Could someone please describe what the entities artist_credit and artist_credit_name are? What does each of their fields represent( in the same way primary entities and their fields are described)? (bonus point if french translations are provided)
I’m also kind of surprised they are not considered primary entities when they appear to be central in how primary entities are linked.

1 Like

Someone who’s actually an MB developer should probably correct me (:slightly_smiling_face:), but here are some guesses from looking at the create statements from admin/sql/CreateTables.sql in the musicbrainz-server repo (sorry, I don’t speak French!):

CREATE TABLE artist_credit ( -- replicate
    id                  SERIAL,
    name                VARCHAR NOT NULL,
    artist_count        SMALLINT NOT NULL,
    ref_count           INTEGER DEFAULT 0,
    created             TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    edits_pending       INTEGER NOT NULL DEFAULT 0 CHECK (edits_pending >= 0),
    gid                 UUID NOT NULL

CREATE TABLE artist_credit_name ( -- replicate (verbose)
    artist_credit       INTEGER NOT NULL, -- PK, references CASCADE
    position            SMALLINT NOT NULL, -- PK
    artist              INTEGER NOT NULL, -- references CASCADE
    name                VARCHAR NOT NULL,
    join_phrase         TEXT NOT NULL DEFAULT ''

It looks like each row in the alternative_release, alternative_track, recording, release, release_group, and track tables points at a single row in the artist_credit table via the artist_credit columns, and then there are one or more rows in the artist_credit_name table referencing the artist_credit row (probably artist_count of them, specifically).

The artist_credit_name columns seem somewhat self-explanatory if you click the Edit button on the Add Standalone Recording page:

  • position is probably the artist’s position in the list
  • artist is the database ID (not MBID) of the underlying artist entity
  • name probably corresponds to the “Artist as credited” field
  • join_phrase probably corresponds to the “Join phrase” field

As far as the artist_credit columns go, I’d guess that the name field contains the full credit text built from the joined artist_credit_name rows, but I don’t have a dump handy to confirm that. Speculating even more wildly, maybe ref_count counts the number of rows in other tables that reference the artist_credit row so it can be dropped once it’s no longer needed.


@derat answered to these questions very accurately. Note that the tables alternative_release and alternative_track are not currently used, it’s for a future feature. Ça vaut bien un point de bonus.

I guess that you are referring to the documentation page MusicBrainz Database / Schema - MusicBrainz where “Primary” means “that can have relationships”. We are currently working on clarifying this terminology; See the ticket [MBS-12552] Define usage of the term “entity type” - MetaBrainz JIRA ; And after that this doc page will be updated; See the work in progress at MusicBrainz Database/Schema - MusicBrainz Wiki.


Also, seems like no one else has linked it, so in case you’re not at all aware of what Artist Credits are in MusicBrainz, you might want to give this a read :slight_smile: :

1 Like