当一个整数列在sqlite表中被标记为主键时,是否应该为它创建一个索引? sqlite似乎不会自动为主键列创建索引,但也许它索引它,无论如何,给定其目的? (我将始终在该列上搜索)。
字符串主键的情况会有什么不同吗?
It does it for you.
原文链接:https://www.f2er.com/sqlite/198375.htmlINTEGER 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.