nemomobile/qtcontacts-sqlite — pull request #164 by special (2014-06-27 12:20:02+00:00)
Title: [qtcontacts-sqlite] Make DetailsJoinIndex unique to optimize queries

SQLite 3.8.5's query planner weighs the detail queries differently, and
(somewhat inexplicably) decides to create an automatic index similar to
DetailsJoinIndex rather than using it. That slows down many queries by
15-20ms, leading to delays of multiple minutes in some cases.

We should look into analyzing the indexes properly, but the best way to
optimize this query now is to make Details(detailId, detail) a unique
index.

If there are concerns with the uniqueness of existing data for these
fields, we can work around the problem using INDEXED BY in the affected
queries.