I'm putting tables together in MySQL workbench and I'm currently ticking my primary keys to also be uniquely indexed. Is this a redundant configuration?


In MySQL, like in most other DBMS, each primary key is already indexed, so it is not necessary to ask for explicit indexing.

| improve this answer | |
  • Workbench is telling me that my primary key is needed to be uniquely index for it to be a foreign key, too. It won't let me uncheck it and apply without it on. – codaamok Jun 21 '15 at 20:31
  • What exact error do you get? Workbench allows to mark a column as PK, UQ or both. If a column is marked as PK, it would not force you to make it as UQ, too. (unless you have composite keys, is that the case)? – ypercubeᵀᴹ Jun 21 '15 at 20:53
  • @adampski, perhaps you should look at this question: dba.stackexchange.com/questions/45424/… – Renzo Jun 21 '15 at 21:06
  • Answer to ur question is Yes. It is redundant. Primary key is both unique and indexed so u don't need to make it unique. If you cannot achieve this from workbench, it is better to change ur question with providing screenshot and table structure. – Masoud Jun 22 '15 at 3:59

Primary key is unique by nature.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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