On Oct 12, 2011, at 11:36 AM, Fabian wrote:

> How would I optimize the above queries, to take advantage of the
> LIMIT/OFFSET values, making them suitable for fast pagination?

Are you sure the issue is with the fts table? Or is it the order by desc?

In any case, you can easily refactor the query into two steps:

(1) First get your pagination
(2) Then join to your fts

select    table1.data1, 
          table2.data2
from      (
            select    table1.data1
            from      table1

            where     table1.data1 = 10

            order by  table1.rowid desc
            limit     250
            offset    0
          )
as        table1 

join      table2 
on        table1.rowid = table2.rowid


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

Reply via email to