Re:SQLite 3.8.0 Release with next-generation query planner
by chris_wot on Tuesday August 27, 2013 @10:55AM
(#6283781)
The optimiser might not be using an index in the most optimal way. Sometimes you have to guide the optimiser and it may not have enough statistical data to get the best plan. One way of doing this is to rewrite the query. In this case, if I had to hazard a guess, the developers have suggested you break down the where clause from OR conditions to instead use a UNION ALL, which may help influence the optimizer to choose the most optimal plan.
Adding statistics or an index may help. Just understand that if your data distribution changes radically the index or rewritten query may no longer be valid.
Adding statistics or an index may help. Just understand that if your data distribution changes radically the index or rewritten query may no longer be valid.