Skip to content
Commit 7b567472 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Merge branch 'parttable-optimization'

The 'name' column in PartTable has been removed and it's content is
now stored in PartTypeTable table. Instead PartTable has partTypeId
column that references respective records in PartTypeTable.

This positively improves performance of SQL queries on PartTable
(which is the largest table in Akonadi, >1 million records is not
uncommon), as the database does not have to perform string
comparision against the entire table in WHERE queries, but only does
numerical comparision during JOIN, and the strings are compared against
the PartTypeTable, which is much smaller (~15 rows).

By having numerical, rather than string index and by removing massive
string duplication, size of the PartTable file on disk is reduced by
up to 30%.

To apply this changes a migration of PartTable is necessary. The
migration happens only once - the first time Akonadi is started after
update. Since the migration involves copying /all/ records in PartTable
to another table and reconstructing an index on the entire table, the
migration can take up to 10 minutes (depending on size of the table).
During that time all Akonadi-enabled applications cannot be used and
will show a busy progressbar and a message that Akonadi is being
upgraded.

Internally this merge introduces so called 'complex updates'. Complex
updates are implemented in DbUpdated as a Q_SLOT called
complexUpdate_%targetVersion%() and allows more complicated logic to
be involved during the update. The classical way of updating DB schema
by placing queries into dbupdate.xml file is still supported.

Conflicts:
	server/src/akonadi.cpp
	server/src/handler/fetchhelper.cpp
	server/src/storage/datastore.cpp
	server/src/storage/dbinitializer.cpp
	server/src/storage/dbupdate.xml
	server/src/storage/dbupdater.cpp
	server/src/storage/dbupdater.h
	server/src/storage/itemretriever.cpp
parents 407a92fd d6afe0c7
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment