[Akonadi] [Bug 351475] Optimization of an SQL query

Daniel Vrátil dvratil at kde.org
Fri Aug 21 19:11:38 BST 2015


https://bugs.kde.org/show_bug.cgi?id=351475

--- Comment #3 from Daniel Vrátil <dvratil at kde.org> ---
Reconstructing queries from SQL builder is hard :-) This is the correct query:

SELECT count(DISTINCT PimItemTable.id), sum(PimItemTable.size), sum(CASE WHEN
PimItemFlagRelation.flag_id = $1 OR PimItemFlagRelation.flag_id = $2 THEN 1
ELSE 0 END) FROM PimItemTable LEFT JOIN PimItemFlagRelation ON PimItemTable.id
= PimItemFlagRelation.pimitem_id WHERE PimItemTable.collectionId = $3

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Kdepim-bugs mailing list