Hello,

I've just wanted to ask about using covering indexes for scans. A very rudimentary test:

create table t (c1,c2, c3, c4);
create index idxtc1 on t(c1);

The simple "select" scans the full table:

  explain query plan select c1 from t;
    SCAN TABLE t (~1000000 rows)

A select with a dummy "order by" uses the covering index:

  explain query plan select c1 from t order by c1;
    SCAN TABLE t USING COVERING INDEX idxtc1 (~1000000 rows)

It seems to me that using a covering index scan would always be faster in both cases (fewer disk page reads). Am i wrong? Is there a reason for SQLite to not use a covering index for scans?

Thank you in advance,

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

Reply via email to