Re: [sqlite] Understanding query optimizer choices

2017-11-03 Thread Simon Slavin
On 4 Nov 2017, at 12:34am, Deon Brewis wrote: > I have a query that joins with a virtual table where the optimizer has a > choice of picking between 2 indexes for something, and it picks by far the > wrong one. Execute the SQL command ANALYZE. You can add this to your app temporarily, or u

Re: [sqlite] Understanding query optimizer choices

2017-11-03 Thread Richard Hipp
On 11/3/17, Deon Brewis wrote: > > Is there a way that I can view the cost metrics that goes into each query > plan choice to see how it calculates the best index? > (1) Get a copy of the canonical source tarball (2) ./configure --enable-debug; make (3) ./sqlite3 $yourdatabase (4) At the "sqlite>

[sqlite] Understanding query optimizer choices

2017-11-03 Thread Deon Brewis
I have a query that joins with a virtual table where the optimizer has a choice of picking between 2 indexes for something, and it picks by far the wrong one. I'm trying to understand how it all works. I understand the output of both 'explain' and 'explain query plan' but I can't see from eithe