I can't see any obvious reason why Q3 should ever return a value larger than Q2. As such, I wonder if the issue is caused by database corruption. In particular, if Q3 uses an index for the search, but Q1/Q2 don't (or vice versa), then a corrupted index could be the culprit. As a test, I'd suggest running the following command: PRAGMA integrity_check; If it returns a single row with the value "ok", then no corruption was detected. However, if it returns anything else, then it indicates that there is database corruption, and might explain the issue.