Re: [sqlite] "wrong" index chosen, why?

2007-07-11 Thread Chris Eich
Joe, the two plans are actually equal (within a few %). Thanks for all your help folks! I've learned quite a bit and I hope other readers did too. Chris

Re: [sqlite] "wrong" index chosen, why?

2007-07-11 Thread Joe Wilson
--- Chris Eich <[EMAIL PROTECTED]> wrote: > Joe, the numbers are 100, 4236301 and 100 respectively (as you suspected, > there are few devices, many intervals, and all devices have intervals). > > Richard, sqlite_stat1 has these rows for the dpi indexes: > INSERT INTO "sqlite_stat1" VALUES('devic

Re: [sqlite] "wrong" index chosen, why?

2007-07-11 Thread Chris Eich
Joe, the numbers are 100, 4236301 and 100 respectively (as you suspected, there are few devices, many intervals, and all devices have intervals). Richard, sqlite_stat1 has these rows for the dpi indexes: INSERT INTO "sqlite_stat1" VALUES('device_perf_interval','dpi1','4236301 2118151 21182 21182

Re: [sqlite] "wrong" index chosen, why?

2007-07-11 Thread drh
Joe Wilson <[EMAIL PROTECTED]> wrote: > --- Chris Eich <[EMAIL PROTECTED]> wrote: > > Thanks, I tried both 3.3.13 and 3.4.0. With 3.3.13 the +'s didn't make a > > difference; the loops always were in d, dpi order with index dpi1 used. With > > 3.4.0 the loops were always in dpi, d order with index

[sqlite] "wrong" index chosen, why?

2007-07-10 Thread Chris Eich
I have a database with the following tables: CREATE TABLE device ( device_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, device_type INTEGER NOT NULL, -- lookup in device_type ... ); CREATE TABLE device_perf_interval ( interval_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,