On 22 Feb 2016, at 9:07am, Michele Pradella <michele.pradella at selea.com> 
wrote:

> Already done this check. My last question was about to reduce the number of 
> indexes on table avoiding kill a "quite unnecessary" index that if used do a 
> better job that the other.
> Generally speaking, I think that if you use and index on (field1) and an 
> index on (field1,field2) the work that SQLite have to do to create and use 
> each index is different. So from point of view of SELECT statement, if the 
> WHERE clause include only field1, is it the same for SQLite to use index on 
> (filed1) compared from using the index on (field1,filed2)?

Oh, right.

If you have one index on (field1) and an index on (field1,field2), the index on 
(field1) is completely pointless and can be deleted.  SQLite will use the other 
one, and it will get the correct result by using it.

So as I wrote in another thread two days ago ...

"If you have a long index, and shorter index which is the start of it, you 
don't need the shorter index."

Simon.

Reply via email to