field_config_entity_type.type is a varchar(255). Do we really need so many characters to name our entities. In what situation would a sane developer use 255 characters to name an entity? In MySQL 5.0 InnoDB, keys are limited to 1024 bytes, which translates to 341 chars. That means that if you want to create a key containing an entity type, you're limited to 84 extra chars for the other columns. We just run into this problem in #493030: RDF #1: core RDF module where we created a key for (type, bundle), respectively varchar(255), varchar(128) which turned out to be a time consuming disaster to debug against the testing bot. The block module for example creates a key on 3 varchar columns, but their size is much smaller (64 max each).

In general, our machine readable names are smaller:
node_type.type: varchar(32)
field_config.field_name: varchar(32)
field_config.type: varchar(128)
field_config_instance.bundle: varchar(128)

CommentFileSizeAuthor
#1 600490_entity_type_size_1.patch568 bytesscor
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scor’s picture

Status: Active » Needs review
FileSize
568 bytes

this patch changes field_config_entity_type.type to varchar(128) instead of varchar(255).

scor’s picture

Title: Do we really need varchar(255) for storing entity types in the db? » Switch entity type column from varchar(255) to varchar(128)

better title

yched’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.