SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC;

Since I have the index on PK1, I believe the rows will be returned in the
ORDER of PK1. Putting an ORDER BY clause will be a no-op. 
Do you think otherwise?


Gabríel "A." Pétursson wrote:
> 
> Be aware that if you do not specify an ORDER BY clause, the order of the 
> returned rows are undefined. You might not even end up with rows with a 
> primary key even near 100.
> 
> What you probably want is:
>    SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC;
> 
> Other than that, those two queries should be near identical in your 
> situation. Mind the gaps.
> 
> On 10/07/2011 03:24 PM, cricketfan wrote:
>> Any advice would be greatly appreciated.
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/SQLITE-LIMIT-clause-tp32607006p32624793.html
Sent from the SQLite mailing list archive at Nabble.com.

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

Reply via email to