Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望为某些列创建索引以提高查找和排序速度。如果该列标记为UNIQUE,例如:
UNIQUE
CREATE TABLE "foo" ( "bar" TEXT NOT NULL UNIQUE )
列“bar”现在是否以如下方式编入索引:
CREATE INDEX foo_bar ON foo(bar)
不会为搜索和排序提供速度奖励?
UNIQUE和PRIMARY KEY约束确实创建了一个内部索引来加速他们的查找,所以你不需要创建你自己的。 (见文档)
PRIMARY KEY