2014-03-28 27 views
0

我有唯一约束我还需要明确创建综合指数,如果我有一个复合唯一约束

create table if not exists watchlist(
    _id integer primary key autoincrement, 
    country text not null, 
    name text not null, 
    unique (country, name) on conflict replace 
); 

表由于我的查询会在WHERE参与countryname条款的大部分时间。为了加快查询,我在想,我还需要创建

create index idx_country_name on watchlist(country, name); 

回答

1

你的唯一约束都已经创建隐式索引,将自动SQLite的创建。因此,不需要在这些列上创建唯一的索引。