Hi, On Mon, Apr 20, 2015 at 11:18:56AM +0200, Clemens Ladisch wrote: > > SQLite does not keep statistics automatically. Run ANALYZE.
Thanks for the explanation. I just performed some measurements. When I use the database with PRIMARY KEY/UNIQUE constraints, the program uses 540s of CPU time before ANALYZE, and 17.5s of CPU time after ANALYZE. Much better! But if I use the database withouth PRIMARY KEY/UNIQUE constraints, it uses 5.7s of CPU time before ANALYZE, and 86s of CPU time after ANALYZE? The performance with PRIMARY KEY/UNIQUE constraints, after ANALYZE, is decent enough, but it?s still significantly slower than the database without the constraints before ANALYZE, which looks odd to me. > If that does not help, we'll have to look at the actual queries (and > their EXPLAIN QUERY PLAN output). That would certainly help, but I would have to ask for permission to make this information public, or to anonymize even the names of the tables and columns. Thanks for your help, -- Nicolas Boullis