- 1 Primary entities
- 2 Secondary entities
- 3 Schema
- 3.1 *_alias tables
- 3.2 annotation table, & the *_annotation tables
- 3.3 tag table, & the *_tag and _tag_raw tables
- 3.4 *_gid_redirect tables
- 3.5 *_rating_raw & *_meta tables
- 3.6 *_type tables
- 3.7 Advanced Relationship table structure
- 3.8 Cover Art Archive table structure
- 4 Undocumented tables
Each primary entity has a main table with the same name as the entity, containing its basic data.
A country, region, city or the like.
An artist is generally a musician, a group of musicians, or another music professional (composer, engineer, illustrator, producer, etc.)
Labels represent mostly (but not only) imprints.
A venue, studio or other place where music is performed, recorded, engineered, etc.
- Album version of the track "Into the Blue" by "Moby"
- Remix "Into the Blue (Buzz Boys Main Room Mayhem mix)" by "Moby"
- Remix "Into the Blue (Underground mix)" by "Moby"
Real-world release object you can buy in your music store. It has release date and country, list of catalog number and label pairs, packaging type and release status. Examples:
- 1984 US release of "The Wall" by "Pink Floyd", release on label "Columbia Records" with catalog number "C2K 36183" and UPC "074643618328", it's an official release and comes with two CDs in jewel case.
Represents an abstract "album" (or "single", or "EP") entity. Technically it's a group of releases, with a specified type. Examples:
One layer above recordings ("song", "composition", etc.). While a recording represents audio data, a work represents the composition behind the recording. Advanced Relationships are used to link recordings and works.
- Song "Into the Blue" by "Moby" -- all the recordings listed above will be linked to this object
List of artists, variations of artist names and pieces of text to join the artist names. Examples:
- "Queen & David Bowie" -- two artists ("Queen" and "David Bowie"), no name variations, joined with " & "
- "Jean-Michel Jarre" -- one artist ("Jean Michel Jarre"), name variation "Jean-Michel Jarre"
- "Tracy W. Bush, Derek Duke, Jason Hayes and Glenn Stafford" -- four artists, no name variations, joined with commas and an "and".
This entity represents a piece of media, included in a release. It contains information about the format of the media, its position in the release, an optional title, and most importantly, a list of tracks. CD TOCs are attached to mediums, not releases or release_groups.
- CD1 of the 1984 US release of "The Wall" by "Pink Floyd"
- CD2 of the 2005 UK release of "Aerial" by "Kate Bush", named "A Sky of Honey"
This entity is not visible to users on its own, only in the context of a release. It has an MBID, and contains a link to a recording, a title, artist credit and position on its associated medium.
This entity represents a URL pointing to a resource external to MusicBrainz, i.e. an official homepage, a site where music can be acquired, an entry in another database, etc.
This schema diagram shows the core database tables and relationships between them. Core entities are blue, mostly-static lists are yellow, and external identifiers are red. There is also a higher resolution schema diagram.
The primary entities area, artist, label, place and work have _alias tables, all of which have the same structure. They contain the alternate names for instances of those entities.
annotation table, & the *_annotation tables
Each of the 8 primary entities (area, artist, label, place, recording, release, release_group, & work) has a corresponding _annotation table that links entities of that type to entries in the main annotation table which contains the actual text of the annotation, along with the changelog and the identity of the editor who created it.
tag table, & the *_tag and _tag_raw tables
All but the area primary entity (artist, label, place, recording, release, release_group, & work) have _tag and _tag_raw tables, with the same structure. Both the _tag and _tag_raw tables contain two foreign keys, linked to the associated entity and to the tag table. The _raw_tag tables contain a foreign key, editor, which specifies who added the tag, while the _tag tables instead contain a count of how many times a tag is applied to a particular entity, and a last_updated timestamp.
The tag table contains the actual names of the tags, and a ref_count.
There are 10 _gid_redirect tables, one for each of the 8 primary entities (area, artist, label, place, recording, release, release_group, & work) plus ones for tracks and urls. They are used to redirect one MBID to another when entities are merged.
*_rating_raw & *_meta tables
There are 5 _rating_raw tables, one for each of the primary entities that can be rated: artist, label, recording, release_group, & work. The _rating_raw tables all have the same structure, consisting of the actual rating, expressed as an integer between 0 and 100, and two foreign keys, one linked to the associated entity, and the other linked to the editor table, to specifying who made the rating.
The aggregate rating of each entity is stored in the corresponding _meta table, in the rating field. There is also a rating_count field that specifies how many ratings have been entered for the entity.
The release_group_meta table also contains other fields, and the release entity, even though it cannot be rated, still has a release_meta table, which is used to store other data.
There are 12 _type tables, which are simply mappings between strings and ID numbers, representing various sets of types; areas, artists, labels, places, and works each have a _type and an _alias_type table. release_groups have a release_group_primary_type & release_group_secondary_type tables. Recordings and releases do not have _type tables.
Advanced Relationship table structure
There are tables for every possible combination of the 8 primary entities (area, artist, label, place, recording, release, release_group, & work) plus url, all prefixed with l_ and all with the same format. Two of them are shown in the diagram. They contain a field, edits_pending that is a count of pending changes to the AR, a last_updated field, and three foreign keys: link that points back to the associated entry in the link table, and entity0 and entity1 that point to the associated entry in the corresponding entity table (i.e. artist, recording, url, etc.).
There are two tables that help to avoid unnecessary duplication:
The link table contains the begin and end date info, and the link_type foreign key field that specifies what kind of AR it is. It also has a count of how many other attributes that particular link has in the attribute_count field, and a created field that specifies when it was created.
Each AR attribute either applies to a particular AR or it doesn't. The link_attribute table stores this information, having a record for each attribute_type (a foreign key field for link_attribute_type) of each link.
The AR types and attributes are defined in these three tables, shown at the top of the diagram. They can only be modified by the AR editors.
The link_type table defines the types of ARs available. AR types are arranged in a number of trees, for ease of finding. This tree structure is expressed with the parent and child_order fields; parent is the id of the parent AR type, or null if it's at the root, and child_order orders the children of a given parent AR type. Each AR type has a unique uuid, stored in the gid field, for use in permalinks and external applications. The link between a particular AR type and the corresponding l_ table is formed by the entity_type0 and entity_type1 fields.
The attributes are themselves defined in the link_attribute_type table. Like AR types, attributes form a number of trees (the vast majority of them are individual musical instruments). Besides the parent and child_order fields shared with the link_type table, the link_attribute_table also has a root field, showing the root of the tree that the attribute is part of. Attributes also have names and descriptions which appear in various places where they are displayed, as well as gids and a last_updated timestamp.
The link_type_attribute_type table specifies what attributes can be applied to particular types of ARs; it has the necessary foreign key fields (link_type and attribute_type) and it also specifies how many instances of the attribute (or one of it's children) can be added to the particular AR type in the min and max fields. Currently, most of them allow the attributes to merely be present or absent, a few allow any number of copies of the attribute, or none. The "creative commons licensed download" attribute has to be included exactly once, while the instrument attribute (of the instrument type AR), requires at least one instance.
Cover Art Archive table structure
The Cover Art Archive table structure is fairly simple. The cover_art table stores the actual cover art and associations to edits. art_type stores the acceptable cover art types, and cover_art_type links the two together. release_group_cover_art links a release group to the release whose cover art should represent the release group.
This image also shows the links to tables in the main diagram (as well as the edit table), but not their full schemas; please see other diagrams or the real schema specification for details.
There is one view not shown, which is the index_listing view -- this makes for a slightly nicer interface than joining the tables manually, by providing an array of cover art types and easy pointers for is_front and is_back. Otherwise it largely resembles the cover_art table.
The following tables have not yet been documented in this page. Help is gratefully appreciated!
CREATE TABLE application CREATE TABLE artist_deletion CREATE TABLE artist_ipi CREATE TABLE artist_isni CREATE TABLE artist_credit ( CREATE TABLE artist_credit_name ( CREATE TABLE autoeditor_election CREATE TABLE autoeditor_election_vote CREATE TABLE cdtoc CREATE TABLE cdtoc_raw CREATE TABLE country_area CREATE TABLE edit CREATE TABLE edit_note CREATE TABLE edit_area CREATE TABLE edit_artist CREATE TABLE edit_label CREATE TABLE edit_place CREATE TABLE edit_release CREATE TABLE edit_release_group CREATE TABLE edit_recording CREATE TABLE edit_work CREATE TABLE edit_url CREATE TABLE editor CREATE TABLE editor_language ( CREATE TABLE editor_preference CREATE TABLE editor_subscribe_artist CREATE TABLE editor_subscribe_artist_deleted CREATE TABLE editor_subscribe_collection CREATE TABLE editor_subscribe_label CREATE TABLE editor_subscribe_label_deleted CREATE TABLE editor_subscribe_editor CREATE TABLE gender ( CREATE TABLE iso_3166_1 ( CREATE TABLE iso_3166_2 ( CREATE TABLE iso_3166_3 ( CREATE TABLE isrc CREATE TABLE iswc ( CREATE TABLE label_deletion CREATE TABLE label_ipi CREATE TABLE label_isni CREATE TABLE language CREATE TABLE link_creditable_attribute_type ( CREATE TABLE link_attribute_credit ( CREATE TABLE editor_collection CREATE TABLE editor_collection_release CREATE TABLE editor_oauth_token CREATE TABLE editor_watch_preferences CREATE TABLE editor_watch_artist CREATE TABLE editor_watch_release_group_type CREATE TABLE editor_watch_release_status CREATE TABLE medium CREATE TABLE medium_cdtoc CREATE TABLE medium_format CREATE TABLE replication_control CREATE TABLE release_country ( CREATE TABLE release_unknown_country ( CREATE TABLE release_raw CREATE TABLE release_coverart CREATE TABLE release_label ( CREATE TABLE release_packaging CREATE TABLE release_status CREATE TABLE release_group_secondary_type_join ( CREATE TABLE script CREATE TABLE script_language CREATE TABLE tag CREATE TABLE tag_relation CREATE TABLE track CREATE TABLE track_raw CREATE TABLE medium_index CREATE TABLE url CREATE TABLE vote CREATE TABLE work_attribute_type ( CREATE TABLE work_attribute_type_allowed_value ( CREATE TABLE work_attribute (