geary/sql
Charles Lindsay c3e5270517 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
2014-03-12 16:39:22 -07:00
..
CMakeLists.txt Fix a number of database hiccups 2014-03-12 16:39:22 -07:00
version-001.sql Remove SQLHeavy: Closes #5034 2012-07-11 15:40:39 -07:00
version-002.sql Remove SQLHeavy: Closes #5034 2012-07-11 15:40:39 -07:00
version-003.sql Remove SQLHeavy: Closes #5034 2012-07-11 15:40:39 -07:00
version-004.sql Remove SQLHeavy: Closes #5034 2012-07-11 15:40:39 -07:00
version-005.sql Autocomplete addresses in To, CC, BCC fields: Closes #4284. 2012-08-16 16:07:43 -07:00
version-006.sql Properly decode Unicode folder names; fix #5217 2013-02-25 15:01:37 -08:00
version-007.sql Prefetch mail in background according to age of message: Closes #6365 2013-02-25 20:18:37 -08:00
version-008.sql Add index to in_reply_to column; fix #6504 2013-03-11 14:34:33 -07:00
version-009.sql Allow external images from whitelisted senders to be displayed: Closes #5642 2013-05-14 18:07:53 -07:00
version-010.sql Closes #7120 Store and update unseen count in database 2013-06-21 18:20:56 -07:00
version-011.sql Merge branch 'master' into feature/search 2013-06-24 17:54:41 -07:00
version-012.sql Merge branch 'master' into feature/search 2013-06-24 17:54:41 -07:00
version-013.sql Non-image inline attachments not shown in client: Closes #5748 2013-07-19 16:28:56 -07:00
version-014.sql Set SQLite page size to 4K: Closes #7423 2013-09-24 18:48:12 -07:00
version-015.sql In Non-English locales, Geary displays wrong month: Closes #7354 2013-09-25 18:04:58 -07:00
version-016.sql Index attachment filenames properly; fix #7575 2013-10-02 12:56:25 -07:00
version-017.sql Add option to save sent mail 2014-01-29 18:18:31 -08:00
version-018.sql Don't multithread db upgrades 2014-03-03 17:40:53 -08:00
version-019.sql Validate contact emails before adding 2014-02-21 15:00:57 -08:00
version-020.sql Fix a number of database hiccups 2014-03-12 16:39:22 -07:00
version-021.sql Fix a number of database hiccups 2014-03-12 16:39:22 -07:00