Hello,

We have two virtual tables that are ordered, and we do a "union all" of them asking from SQLite to keep the result ordered.

So the query looks like this:

select * from (select x from ordered_VT1 UNION ALL select x from ordered_VT2) order by x;

Both of ordered_VT1, ordered_VT2 report back (via BestIndex) that their results are ordered on x. Note that when SQLite negotiates with the ordered_VT1,2 (via BestIndex), it doesn't even ask them if an ordering on x already exists.

Right now SQLite does a full scan of ordered_VT1, and then ordered_VT2 before starting to produce results.

Shouldn't it do a merge union all of the two? Is there some way to help SQLite's planner to "see" that such a possibility exists?

Kind regards,

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

Reply via email to