When should I use primary key or index?

后端 未结 6 1797
感动是毒
感动是毒 2020-12-04 11:12

When should I use a primary key or an index?

What are their differences and which is the best?

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 11:42

    Every table should have a PRIMARY KEY.

    Many types of queries are sped up by the judicious choice of an INDEX. It may be that the best index is the primary key. My point is that the query is the main factor in whether to use the PK for its index.

提交回复
热议问题