On Fri, Mar 28, 2014 at 5:39 PM, Gergely Peli <p...@t-online.hu> wrote:

> sqlite> CREATE TABLE t (a INTEGER, b INTEGER, c INTEGER, d BLOB);
> sqlite> CREATE INDEX appropriate ON t (a, b, c);
> sqlite> CREATE INDEX inappropriate ON t (b, c);
> sqlite> EXPLAIN QUERY PLAN SELECT d FROM t WHERE a = ? AND b = ? AND c >= ?
> ORDER BY c;
> 0           0           0           SEARCH TABLE t USING INDEX
> inappropriate
> (b=? AND c>?)
>
> Adding an INDEXED BY clause to
> the query to force the right index yields a 50x speedup in my case
> (compared
> to 3.7.16.2).
>

What happens if you omit the INDEXED BY clause and instead run ANALYZE?


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

Reply via email to