The results I wrote was after executing the ANALYZE. 

But If I drop the stat1 and stat3 tables, the query is faster and I see in the 
output of the "explain query plan" that my index is used.

Selen


________________________________
 From: Simon Slavin <slav...@bigfraud.org>
To: Selen Schabenberger <selen_oz...@yahoo.com>; General Discussion of SQLite 
Database <sqlite-users@sqlite.org> 
Sent: Monday, January 14, 2013 3:33 PM
Subject: Re: [sqlite] Query planning with concatened vs single index
 

On 14 Jan 2013, at 2:30pm, Selen Schabenberger <selen_oz...@yahoo.com> wrote:

> As far as I know, the index (column1, column2, column3) is more useful than 
> the index (column1). Why does the analyzer not like the concatened index for 
> that query? Did I misunderstand the whole idea with the multi-column indexes?

You can get clues about what indexes will be used using the 'EXPLAIN QUERY 
PLAN' command:

<http://www.sqlite.org/eqp.html>

Just out of interest, with the same setup and the data you describe in your 
question already entered, execute the SQL command 'ANALYZE' and then do your 
SELECTS again.  See if SQLite chooses the same strategies.

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

Reply via email to