Fix a number of database hiccups
1) Use docid instead of id in search table. We had previously included an 'id INTEGER PRIMARY KEY' column in the MessageSearchTable, assuming it would get the same rowid alias treatment as it does in non-FTS tables. That assumption was wrong: it was being created as a FTS column. This fixes it so we use docid everywhere. To fix the old incorrect docid values, we simply blow away the search table and let the natural search table population process, which now has the correct docid insertion code, fix the problem. This also removes the id column from the search table creation SQL, but this will only affect new users. Upgraders will see an empty, vestigal id column in their search table. Since SQLite doesn't easily let you remove columns, it's just easier to ignore the column than go through all the work to fix it. 2) Do as many rowid lookups as possible in batches, instead of doing them individually in loops. This speeds up working with large sets of email. 3) Rejigger indices on the MessageLocationTable to make certain queries faster. This creates a new covering index in particular for the email prefetcher, which previously had to sort using a temp table. The new index should work in the general case too, as we should never be looking at ordering without folder_id (and since folder_id comes first, it works as an index on just folder_id, too). 4) For bonus measure, log all slow queries (> 1s execution time) to debug output. Closes: bgo #725929
This commit is contained in:
parent
479f87e2ca
commit
c3e5270517
10 changed files with 191 additions and 81 deletions
7
sql/version-020.sql
Normal file
7
sql/version-020.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
--
|
||||
-- We had previously incorrectly included an id column in the search table.
|
||||
-- The code is fixed to use docid instead, so we just empty the table and let
|
||||
-- the natural search table population process make things right.
|
||||
--
|
||||
|
||||
DELETE FROM MessageSearchTable
|
||||
Loading…
Add table
Add a link
Reference in a new issue