List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:September 2 1999 9:02am
Subject:Re: Create Tabe Syntax
View as plain text  
At 01:52, 19990902, Jason wrote:
>I keep getting the error: "Specified key was too long. Max key length is

Jason, you're combining three fields in one key, and the total of the
sizes of those fields is > 256.  That's a limitation in MySQL.  So you
have to either reduce the size of those fields, remove some of the
fields from the key, or form a key using only portions of those fields.

You probably don't want all of those in the same key.  Split them into
four separate keys:

    create table the_links
        link_id int unsigned not null auto_increment primary key,
        url varchar(255) not null,
        title varchar(255) not null,
        content varchar(255) not null,

        /* already have link_id as the PRIMARY KEY */
        index index2 (url)
        index index3 (title)
        index index4 (content)

Note that if you'd kept them as one key, and then did a select like
the following, the index would NOT have been used:

    SELECT link_id, title FROM the_links WHERE url LIKE ''

But if you break up the index into separate pieces, then an index will
be used on that query.

newbie questionCarolyn Campbell2 Sep
  • Re: newbie questionThimble Smith2 Sep
  • Re: newbie questionJeff Urban2 Sep
  • Re: newbie questionSteve Ruby2 Sep
    • RE: newbie questionCarolyn Campbell2 Sep
      • Create Tabe SyntaxJason2 Sep
        • Re: Create Tabe SyntaxThimble Smith2 Sep
      • Re: Create Tabe SyntaxJason2 Sep
        • Re: Create Tabe SyntaxPaul DuBois2 Sep
Re: Create Tabe SyntaxDave Kaufman2 Sep
Re: Create Tabe SyntaxDave Kaufman2 Sep