[Bug 311542] Same SQL queries performed multiple times when fetching one email
Alex Richardson
arichardson.kde at googlemail.com
Tue Dec 11 20:15:29 GMT 2012
https://bugs.kde.org/show_bug.cgi?id=311542
--- Comment #3 from Alex Richardson <arichardson.kde at googlemail.com> ---
Also the queries in line 5 and 6 of the filtered log could be merged into one:
... WHERE ( ( PartTable.name IN ( 'PLD:RFC822', 'COLLECTIONID',
'ATR:ErrorAttribute' ) OR substr( PartTable.name, 1, 4 ) = ( 'PLD:' ) OR
substr( PartTable.name, 1, 4 ) = ( 'ATR:' ) ) AND ( PimItemTable.id = 148263 )
) ORDER BY PimItemTable.id DESC
... WHERE ( ( PartTable.name IN ( 'PLD:RFC822', 'COLLECTIONID', 'PLD:HEAD' ) OR
substr( PartTable.name, 1, 4 ) = ( 'PLD:' ) OR substr( PartTable.name, 1, 4 ) =
( 'ATR:' ) ) AND ( PimItemTable.id = 148263 ) ) ORDER BY PimItemTable.id DESC
The only difference is the third item in the IN (...) clause.
It could be simplified to
... WHERE ( ( PartTable.name = 'COLLECTIONID' OR substr( PartTable.name, 1, 4 )
= ( 'PLD:' ) OR substr( PartTable.name, 1, 4 ) = ( 'ATR:' ) ) AND (
PimItemTable.id = 148263 ) ) ORDER BY PimItemTable.id DESC
Or maybe even
... WHERE ( ( PartTable.name = 'COLLECTIONID' OR substr( PartTable.name, 1, 4 )
IN ( 'PLD:', 'ATR:' ) ) AND ( PimItemTable.id = 148263 ) ) ORDER BY
PimItemTable.id DESC
which is more readable and could also be faster.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Kdepim-bugs
mailing list