What are the biggest benefits of using INDEXES in mysql?

后端 未结 7 1881
无人共我
无人共我 2020-12-09 17:44

I know I need to have a primary key set, and to set anything that should be unique as a unique key, but what is an INDEX and how do I use them?

What are the benefits

7条回答
  •  独厮守ぢ
    2020-12-09 18:10

    You don't have to have a primary key. Indexes (of any type) are used to speed up queries and, at least with the InnoDB engine, enforce foreign key constraints. Whether you use a unique or plain (non-unique) index depends on whether you want to allow duplicate values in the key.

提交回复
热议问题