Seems to have the same effect, adding a key to the table and set up the index of the table, can be fast data query.
The difference between them is that they are on different levels.
Key is a part of the relational model theory, such as a primary key (Primary key), a foreign key (Foreign key), etc., for data integrity checking and uniqueness constraints.
Index is at the implementation level, such as the table can be indexed to any column, then when the indexed column in the SQL statement in the where condition, you can get a fast data-set , so fast retrieval. As for the unique index, it is only one of the index, the creation of a unique index indicates that this column of data is not repeatable, guess MySQL index of unique index type can be further special optimization bar.
Thus, when designing a table, key is only at the model level, and when query optimization is required, the related columns are indexed.
Also, in MySQL, for a column with a primary key, MySQL has automatically setup the U nique index on it, without having to re-index it.
A section of the search explanation:
Note that the "primary" is called primary KEY not INDEX.
KEY is something on the logical level, describes your table and database design (i.e. enforces referential integrity ...)
INDEX is something on the physical level, helps improve access time for table operations.
Behind every PK there is (usually) unique index created (automatically).
MySQL Key index difference