Cecil Westerhof wrote: > I have the following query: > SELECT used > FROM usedProverbs > LIMIT 1 > > The view useProverbs is defined as: > CREATE VIEW usedProverbs AS > SELECT * > FROM proverbs > WHERE CAST(used AS INT) <> 0 > ORDER BY used ASC > > But I am told this is not clear and that I should use: > SELECT used > FROM usedProverbs > ORDER BY used > LIMIT 1 > > But when I use those in DBBrowser, the first takes almost always 0 ms, > while the second takes between 13 and 16 ms. Why does the second one take > so much more time?
Because only the first sort can be optimized away with an index (which you did not mention). If you believe what you're told (that ORDER BY must be in the outermost query), then remove the ORDER BY from the view. Regards, Clemens _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

