Skip to content

Database table creation can fail with error "Specified key was too long; max key length is 1000 bytes" #148

Closed

Description

@danielbachhuber
WordPress database error Specified key was too long; max key length is 1000 bytes for query CREATE TABLE IF NOT EXISTS

From https://wordpress.org/support/topic/lcache-database-tables-not-created/

Activity

  1. danielbachhuber commented on Sep 28, 2017

    @danielbachhuber
    MemberAuthor
  2. danielbachhuber commented on Sep 29, 2017

    @danielbachhuber
    MemberAuthor

    @fjarrett Do you recall why you changed address to varchar(191) on the tags table but not the events table (#131)?

  3. danielbachhuber commented on Sep 29, 2017

    @danielbachhuber
    MemberAuthor

    Based on this and this, my understanding is that the error happens because Barracuda is not enabled for MySQL, which means our index key length is too long for stock InnoDB.

    If it's a problem we want to solve, we could work around this by setting prefix lengths to each column. Alternatively, we can show a warning when Barracuda isn't enabled.

  4. frankiejarrett commented on Sep 29, 2017

    @frankiejarrett
    Contributor

    @danielbachhuber I think address was left as varchar(255) because it isn't an indexed column in the events table, but on the tags table it's the PRIMARY KEY. In my testing of that feature I was only seeing the error on indexed columns.

  5. danielbachhuber commented on Sep 29, 2017

    @danielbachhuber
    MemberAuthor

    If it's a problem we want to solve, we could work around this by setting prefix lengths to each column. Alternatively, we can show a warning when Barracuda isn't enabled.

    We could also change events.address to varchar(171) (accommodating bigint(20) for event_id), but I wonder if that's too short.

  6. danielbachhuber commented on Sep 29, 2017

    @danielbachhuber
    MemberAuthor

    Looking into this even further, I think we can revert the utf8mb4 charset on creation because our value column is LONGBLOB, which is binary and doesn't use charsets.

  7. added this to the 0.6.1 milestone on Oct 3, 2017
  8. danielbachhuber commented on Oct 3, 2017

    @danielbachhuber
    MemberAuthor

    🔨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions