2011/10/14 Petite Abeille <petite.abei...@gmail.com>

>
> Much? Really? I get the broadly same execution time for either variant:
>
> 0|0|0|SCAN TABLE mail_header USING INTEGER PRIMARY KEY (~2192503 rows)
>
> 0|0|0|SCAN TABLE mail_header (~2192503 rows)
>
>
I get

SELECT mail_header.rowid
FROM mail_header
WHERE data = 1
ORDER BY mail_header.rowid DESC  LIMIT 250 OFFSET 142750

0 0 0 SCAN TABLE mail_header USING INTEGER PRIMARY KEY (~46392 rows)

VS

SELECT mail_header.rowid
FROM mail_header
WHERE data = 1
LIMIT 250 OFFSET 142750

0 0 0 SEARCH TABLE mail_header USING INDEX ididx (id=?) (~66275 rows)


So you seem to get the same speed in both queries, because you have no index
on the column in the WHERE clause, making my EXPLAIN differs from yours? But
when the column is indexed, the 'ORDER BY' makes the query much slower.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to