On Fri, Nov 26, 2010 at 1:34 PM, Swithun Crowe <
swit...@swithun.servebeer.com> wrote:

> Hello
>
> MS> The second index should be:
> MS> CREATE INDEX IDX2 on tx(type, name ASC);
>
> MS> What I had meant to ask was whether there is any benefit in having two
> MS> indexes when one of the indexes is exactly within the other.
>
> MS> IDX1 is index on 'name ASC' while IDX2 is an index on 'type, name ASC'
> -
> MS> does this mean that in a sense IDX1 is a subset of IDX2 and can be
> removed?
>
> If you wanted to have just one index, rather than two, then you could
> have:
>
> CREATE INDEX idx ON tx(name ASC, type);
>
>
Mohit said that he uses a someone's db, so I can imagine a possibility that
with two indexes ...
CREATE INDEX IDX1 on tx(name ASC);
CREATE INDEX IDX2 on tx(type, name ASC);
... the creator of database wanted to search for a name regardless of the
type with a help of first index, and in the context of chosen type with the
second. So, Mohit, if some unknown queries or code involved I'd better leave
them as they are

Max
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to