--- "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?

It should, but sqlite doesn't appear to make that optimization.

Try this instead:

CREATE TABLE profile_data(profile_id INTEGER, version INTEGER);
CREATE INDEX by_id ON profile_data(profile_id);
explain query plan select profile_id from profile_data group by 1;
0|0|TABLE profile_data WITH INDEX by_id ORDER BY


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

Reply via email to