5

i am trying to run alter table command and i am getting the following error:

#1069 - Too many keys specified; max 64 keys allowed

any help will be highly appreciated

2
  • 4
    Reduce the number of keys in the table? Seems rather self-explanator.
    – Marc B
    Feb 16, 2011 at 20:13
  • 2
    A bit more info like the alter table statement would be nice...
    – extraneon
    Feb 16, 2011 at 20:13

3 Answers 3

8

According to the MySQL forums you must compile with

./configure --prefix=/usr/local/mysql --with-charset=cp1251 --enable-thread-safe-client --with-max-indexes=256

Unfortunately there does not appear to be a way to change after compiling.

1
0

This error means there are more than 64 indexes on your table. Each table can only have up to 64 indexes.

You don't usually specify up to 65 indexes, so this error is caused when you run an multiple alter command in mysql and having a UNIQUE index on a column at all times. Because apperently, it seams alter commands is not resetting the index on a unique field but is creating a whole new index.

ie: If column email is marked UNIQUE an idex email is created for it. If you alter the table and still have UNIQUE on column email, a new email index is created for the column but named as email_2 instead of email which could have replaced the previouse one.

The more alter commands you write with email having UNIQUE would cause more email_(n) indexes. That is why the maximum reaches.

To prevent this error

  • if your email column still have UNIQUE on it, remove it or first drop the previous index on the table before you run your alter command. usually ORM users, ORMs run same complete commands on every startup.
  • If you have run a UNIQUE command, an index has already been created so don't run another one. For ORM users, remove the unique constraint from the column properties

NOTE: I have only noticed this in MYSQL and I have noticed that it does not happen to other indexes like primary, fulltext etc. except unique.

This is something I have noticed. I hope it helps

1
  • That’s one explanation. Not necessarily the one that applies.
    – user207421
    Mar 5 at 22:18
-5

Seems like the message is clear... YOu can't have a table with more than 64 keys (Primary, Foreign or even index)

3
  • 3
    how can i resolve this issue if i have a table contains more than 64 keys i.e. is there any parameter to change in order to increase this number
    – Omran
    Feb 18, 2011 at 6:31
  • 2
    If this wanted to be considered an answer, than I suggest explaining why not?
    – Igor L.
    Nov 22, 2013 at 13:08
  • @IgorL. What does it matter why not? It’s a limit. Everything has limits.
    – user207421
    Mar 5 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.