sqlite-users  

Re: [sqlite] indexing rows from a query

Igor Tandetnik
Fri, 16 May 2008 17:04:32 -0700

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]
> My real question is if there is an efficient way to index the results
> of such a query.  In other words, I'm looking for rows N through N+100
> of the result.  Can I do much better than just executing the query and
> throwing away the first N rows?

In general, no. You can use LIMIT and OFFSET clauses, but all that does 
is instruct SQLite to throw away the first N rows so you don't have to 
do it manually.

More often than not, what you really want is not "get 100 rows at 
position N", but "get 100 rows following the rows I've retrieved last 
time". This can in fact be implemented more efficiently: see

http://www.sqlite.org/cvstrac/wiki?p=ScrollingCursor

Igor Tandetnik 



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