Field storage

We earlier saw how configuration entities are persisted and exported based on the configuration schema and plugin definition. Let's quickly talk about how the fields used on content entities are stored in the database.

Base fields, by default, end up in the entity base table (the one defined in the plugin annotation as base_table). This makes things more performant than having them in individual tables. However, there are some exceptions to this.

If the entity type is translatable, a "data" table gets created where records of the same entity base field values in different languages can be stored. This is the table the Node entity type plugin annotation declared with the property data_table. If this property is missing, the table name will by default be [base_table]_field_data.

Moreover, if the field cardinality of a given field is higher than 1, a new table is created for the field with the name [entity_type_name]__[field_name] where multiple records for the same field can be stored.

If the entity and field have translation enabled and the respective field cardinality is higher than one, the "data" table holds the records for an entity in all languages it is translated into, while the [entity_type_name]__[field_name] table holds all the value records in all languages for a given field.

Configurable fields, on the other hand, always get a separate field data table named [entity_type_name]__[field_name], where the multiple values for the same field and in multiple languages can be stored.