On Sat, 30 Nov 2013 12:24:01 +0200, George <pinkisntw...@gmail.com>
wrote:

>I have a query that is used to populate a table in my website. The query
>joins 4 different tables and returns around 10 columns, and I want to order
>on 4 of them, each of those 4 being on a different table. I also use a
>LIMIT clause for pagination.
>
>I have noticed that when I order using just one column then the query is
>very fast, because no TEMP B-TREE is used. When I add the other columns
>then TEMP B-TREE is used and the query is very slow.
>
>Is there some way to avoid this TEMP B-TREE? Since I am using LIMIT 25, the
>database really only needs to order those 25 (or slightly more) rows.

No, to be able to order those, it has to order the whole result set, and
offer you 25 rows of the ordered result.

You could try to use more restrictive ON and/or WHERE clauses to reduce
the size of the intermediate result set.

For faster pagination, read :
http://sqlite.org/cvstrac/wiki?p=ScrollingCursor 



-- 
Groet, Cordialement, Pozdrawiam, Regards,

Kees Nuyt

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

Reply via email to