SQLite中的主键是否需要索引?

一个整数列在sqlite表中被标记为主键时,是否应该为它创建一个索引? sqlite似乎不会自动为主键列创建索引,但也许它索引它,无论如何,给定其目的? (我将始终在该列上搜索)。

字符串主键的情况会有什么不同吗?

It does it for you.

INTEGER PRIMARY KEY columns aside,both UNIQUE and PRIMARY KEY constraints are implemented by creating an index in the database (in the same way as a “CREATE UNIQUE INDEX” statement would). Such an index is used like any other index in the database to optimize queries. As a result,there often no advantage (but significant overhead) in creating an index on a set of columns that are already collectively subject to a UNIQUE or PRIMARY KEY constraint.

相关文章

SQLite架构简单,又有Json计算能力,有时会承担Json文件/RES...
使用Python操作内置数据库SQLite以及MySQL数据库。
破解微信数据库密码,用python导出微信聊天记录
(Unity)SQLite 是一个软件库,实现了自给自足的、无服务器...
安卓开发,利用SQLite实现登陆注册功能