In the call to create index, it looks like you're creating a duplicate
index on [id], which I believe references the default btree id (also
called rowid.)  If you change that line to:

CREATE INDEX [by_id] ON [profile_data] ([profile_id]);

your index should  be used (though whether indexes get used with
select distinct clauses, I'm not sure.)

Ian

On Nov 8, 2007 4:30 AM, Maxim V. Shiyanovsky <[EMAIL PROTECTED]> wrote:
> Suppose I have simple table:
>
> CREATE TABLE [profile_data] (
>
>  [profile_id] INTEGER,
>
>  [version] INTEGER);
>
> CREATE INDEX [by_id] ON [profile_data] ([id]);
>
>
>
> Why
>
> sqlite> explain query plan
>
>  ...> select distinct(profile_id) from profile_data;
>
> 0|0|TABLE profile_data
>
>
>
> Does not use index?
>
>

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to