[sqlite] SQLite not using primary key index anymore

2015-05-19 Thread Eric Grange
> The SQLite I have here uses the primary key. It works now after another round of drop index/create index/analyze. The problem is/was related to the DB, I have multiple databases with the same schema, only the largest one had the issue (38 GB), the smaller ones did not. > Which version? While

[sqlite] SQLite not using primary key index anymore

2015-05-19 Thread Clemens Ladisch
Eric Grange wrote: > I recently added a field and index to an existing table, and now SQLite > seems to be using that index in place of the primary key, even on simple > queries > > CREATE TABLE vin ( >id INTEGER PRIMARY KEY AUTOINCREMENT, >tx_id INTEGER NOT NULL, >from_vout_id

[sqlite] SQLite not using primary key index anymore

2015-05-19 Thread Eric Grange
Also while using select id from vin NOT INDEXED order by id desc limit 1 works around the problem, this is just one query of many (and a simplified one at that), and I have other less trivial queries where the inefficient default query plan has the same catastrophic effect on performance, so

[sqlite] SQLite not using primary key index anymore

2015-05-19 Thread Eric Grange
Hi, I recently added a field and index to an existing table, and now SQLite seems to be using that index in place of the primary key, even on simple queries Table declaration: CREATE TABLE vin ( id INTEGER PRIMARY KEY AUTOINCREMENT, tx_id INTEGER NOT NULL, from_vout_id INTEGER,