Hi Swithun

Thank you for your reply.  I'm sorry I was simplifying the schema when I 
sent it out.

On 26/11/2010 5:35 PM, Swithun Crowe wrote:
> Hello
>
> MS>  CREATE TABLE tx (name TEXT, type INTEGER, seq INTEGER, seq_record TEXT,
> MS>  ...);
>
> MS>  CREATE INDEX IDX1 on tx(name ASC);
> MS>  CREATE INDEX IDX2 on tx(type, search_name ASC);
>
> The two indexes cover different columns, so they do different things. The
> indexes you need depend on the queries you will be doing, so there is no
> way I can tell if you need these indexes. Columns which are used in WHERE
> clauses are good candidates for indexing, generally speaking.
>
> You don't show a column called search_name in the CREATE TABLE line. I
> assume there is one.

The second index should be:
CREATE INDEX IDX2 on tx(type, name ASC);
What I had meant to ask was whether there is any benefit in having two 
indexes when one of the indexes is exactly within the other.

IDX1 is index on 'name ASC' while IDX2 is an index on 'type, name ASC' - 
does this mean that in a sense IDX1 is a subset of IDX2 and can be removed?

> A more specific answer would require more information, but I hope this
> helps.

I apologize for the mistake I made in sending out the schema.  Thanks 
again for taking the time to answer.

Best Regards,
Mohit.
26/11/2010 | 5:58 PM.


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

Reply via email to