"Mahalakshmi.m"
<[EMAIL PROTECTED]> wrote
in message
news:[EMAIL PROTECTED]
> I am using
> First 10 --> "SELECT * FROM ARTIST ORDER BY ArtistName LIMIT 10 ;"
> Next 10 ie., 11 to 20 --> "SELECT * FROM ARTIST WHERE ArtistName > ?
> ORDER BY ArtistName LIMIT 10 ;"
> Previous 10 -->"SELECT * FROM ARTIST WHERE ArtistName < ? ORDER BY
> ArtistName DESC LIMIT ? ;"
>
> The above statements provides best performance .i have used < ,>
> since I want the results to be in ORDER BY.
>
> If I don't want to use ORDER BY then how can I optimize without using
> OFFSET.

Why don't you want to use ORDER BY? What's wrong with it?

If you don't want to sort by ArtistName, do the same with ArtistId. 
You'll get records roughly in the order of insertion.

> For this querry "SELECT * FROM ARTIST ORDER BY ArtistName LIMIT 10 ;"
> will it use ARTIST_idx or not.

Run the query again, prepended with EXPLAIN QUERY PLAN. The output will 
tell you. My prediction is - yes, it should use the index.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925 



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to