Is an index needed for a primary key in SQLite?

前端 未结 3 1688
长发绾君心
长发绾君心 2020-12-13 03:32

When an integer column is marked as a primary key in an SQLite table, should an index be explicitly created for it as well? SQLite does not appear to automatically create an

3条回答
  •  心在旅途
    2020-12-13 03:36

    A database will always silently create an index for a unique primary key so it can internally check it is unique efficiently.

    Having created it, it will use it when necessary.

    It won't, of course, always be clustered, and you specify usually in the schema if you want it to be.

提交回复
热议问题