[Kde-pim] [PATCH] Akonadi database optimization
Tobias König
tokoe at kde.org
Fri Jul 30 20:30:57 BST 2010
Hej,
as a proud user of KMail 4.5 I faced some performance problems lately which
happened when entering a folder with many (in words 200) emails.
In this case KMail was waiting nearly 30 seconds until it continued to show
the emails in the message list.
After some debugging, blaming nearly every component of the PIM stack (sorry
Kevin, it was not the maildirresource ;)) and adding debug statements all over
the places, mysqld was identified as the culprit. The problematic call was the
fetch statement for all header payloads of all mails in the current folder.
Just for fun I changed the fetch scope to FullPayload and to my suprise it was
_faster_ then only fetching the headers.
So the SQL query, which varies for both calls must be the issue.
After some discussion with our MySQL-optimizer-Guru (aka milian) we came to
the conclusion that the 'AND PimItemTable.id >= 1' condition in the statement
leads to a performance bottleneck. The reason is that the >= operator will
imply a so called range-join which has a bad performance.
Fortunately this special condition is not really needed, because the 'id'
column will always contain values >= 1 per definition. So we can just optimize
this condition away and KMail 4.5 works as fast as it is supposed to do :)
Attached is a patch that fixes QueryHelper to not add unnecessary >=
conditions. Does somebody see any problems with it?
Ciao,
Tobias
P.S.: Isotopp pointed out another performance problem that we could solve by
handling the PLD parts in a special way. I'll discuss this with Volker on
monday.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: akonadi_queryhelper_optimization.patch
Type: text/x-patch
Size: 1490 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100730/19d8fb3a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100730/19d8fb3a/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