> > On 28 Aug 2010, at 4:24pm, Max Vlasov wrote: > >> I don't know whether my posts have a delay with delivery (replied >> several >> hours ago to the discussion you mentioned), but actually I tested 100 >> rows >> before and after with a similar query (ORDER BY LIMIT) and it definitely >> shows that sqlite saves time and doesn't go further. Do you have reason >> to >> think that it should go to the end? > > Thanks Max. There was a thread where someone suggested the opposite: that > the LIMIT clause operated to trim results which had already been found. > It worried me because I have been assuming that LIMIT meant that SQLite > didn't have to search the entire table.
I think it depends of course if there is an index on the column that is specified in the ORDER BY. Without an index there is no way to limit the searched rows prior applying the sorting. So a simple SELECT * FROM T ORDER BY A LIMIT 10 will be fast with an index on A and slow without. Even if ORDER BY A DESC is specified sqlite still can scan the index. At least that shows a quick experiment using the sqlite3.exe. Marcus > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users