Hi guys, I tried the thing that you proposed.
The EXPLAIN QUERY PLAN showed selectid order from detail 0 0 0 SEARCH TABLE event AS e USING INDEX IDX_event_1 (deleted=? AND major=? AND rowid>?) as you expected. But the timing is still as in the old verions (two tests): 2014-Mar-26 17:57:13.289945:NORM: AGENT REV: 330557:330556. TIME FOR 1000 ITERATIONS: 40182 milliseconds 2014-Mar-26 18:02:16.425186:NORM: AGENT REV: 330557:330556. TIME FOR 1000 ITERATIONS: 40663 milliseconds If I run ANALYZE with the tool and then run the same code with the new db. It returns results like: 2014-Mar-26 18:03:32.115915:NORM: AGENT REV: 330557:330556. TIME FOR 1000 ITERATIONS: 234 milliseconds 2014-Mar-26 18:03:47.483895:NORM: AGENT REV: 330557:330556. TIME FOR 1000 ITERATIONS: 226 milliseconds The returned table values with the second (ANALYZED) version seems correct. I'm wondering why is this big difference? Do you think that the second results are impossibly fast (i.e. something is wrong) and it is related to the different versions of the SQLite tool and the SQLite used in the application? I'm about to build the application with the latest SQLite version and see what will happen. We have plans updating our libraries to the recent versions, and we'll update the SQLite too. By the way, this db schema has existed long before I started my job at the company. So, I'm not the guy who created the schema I'm just the guy who is wondering why the query is slow. Or it is not slow, and I'm just wrong. Thanks for the help, Pavel. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users