[Kde-pim] Excessive amount of queries
Daniel Vrátil
dvratil at redhat.com
Mon Dec 8 13:48:44 GMT 2014
On Monday 08 of December 2014 10:53:59 Milian Wolff wrote:
> On Friday 05 December 2014 18:50:14 Daniel Vrátil wrote:
> > The change has been pushed now, feel free to test :-)
>
> Nice work, seems to have helped a lot already! Some questions on the code:
>
> CollectionStatistics::getCollectionStatistics
> -> could that use CountQueryBuilder?
>
> CollectionStatistics::instance
> -> can we rely on proper static initialization instead, or is this code run
> with compilers that don't implement this properly?
> -> at least, use QMutexLocker please
Well spotted, thanks.
I just pushed another batch of optimizations that reduce the query count even
further, most importantly opening an email in KMail now only does 5 queries
instead of ~200 :-) There are 4 queries done by the FETCH command (SELECT
PimItem, PartTable and FlagTable and UPDATE PimItem), the rest was
SearchHelper::listCollectionsRecursively invoked from SEARCH command (KMail
searches for sender in addressbooks), which was recursively iterating the
entire collection tree, doing one query per collection. I've optimized it, so
in the best case (searching in all collections) we only do one query, and in
the worst case we traverse the chain from each collection with matching
mimetype up to root (or first matching ancestor), which will still be much
fewer queries then previously.
According to your query aggregation view in Akonadi Console, the most-often
invoked queries now are those 4 or 5 queries from FetchHelper - there's
nothing we can do about those - we simply need to query the database for each
item. They represent about 95% of all executed queries (but only about 50% of
overall query duration).
Second are 4 or so queries related to collection statistics and listing of
collections, which together make about 2% of all queries (cca 25% of time)
I think at this point we are pretty good and I wouldn't bother with the
remaining queries much.
Dan
>
> bye
--
Daniel Vrátil | dvratil at redhat.com | dvratil on #kde-devel, #kontact, #akonadi
Software Engineer - KDE Desktop Team, Red Hat Inc.
GPG Key: 0xC59D614F6F4AE348
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20141208/7686203c/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list