Hick Gunter wrote: >create the primary key index ordered properly > >CREATE TABLE t (..., PRIMARY KEY ( a ASC, b DESC)...);
DESC is not necessary here; SQLite has no problem reading the index in reverse order, if needed. (DESC in an index is useful only when you want to optimize multiple ORDER BYs in a single query.) >SELECT b FROM t WHERE a = ? LIMIT 1; This is wrong with or without a DESC index: there is no guarantee that the returned row is the first in the index unless you're using ORDER BY or MAX(). Regards, Clemens _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users