2014-03-28 78 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的創建。因此,不需要在這些列上創建唯一的索引。