Revision 7b56747...
Go back to digest for 24th November 2013Optimization in KDE-PIM
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
File Changes
- server/CMakeLists.txt
- server/src/cachecleaner.cpp
- server/src/handler/akappend.cpp
- server/src/handler/append.cpp
- server/src/handler/fetchhelper.cpp
- server/src/handler/store.cpp
- server/src/storage/datastore.cpp
- server/src/storage/dbinitializer.cpp
- server/src/storage/dbinitializer.h
- server/src/storage/dbinitializer_p.cpp
- server/src/storage/dbinitializer_p.h
- server/src/storage/dbupdate.xml
- server/src/storage/dbupdater.cpp
- server/src/storage/dbupdater.h
- server/src/storage/itemretriever.cpp