Download & Extend

Switch entity type column from varchar(255) to varchar(128)

Project:Drupal core
Version:7.x-dev
Component:base system
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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)

Comments

#1

Status:active» needs review

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

AttachmentSizeStatusTest resultOperations
600490_entity_type_size_1.patch568 bytesIdlePassed on all environments.View details

#2

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

#3

Status:needs review» reviewed & tested by the community

Makes sense.

#4

Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks!

#5

Status:fixed» closed (fixed)

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

nobody click here