[kdepim-users] akonadi fsck fails
Pablo Sanchez
pablo at blueoakdb.com
Wed Aug 26 14:03:28 BST 2015
[ Comments below, in-line ]
On 08/26/2015 07:52 AM, Daniel Vrátil wrote:
>> 1) Create a DELETE-statement which includes the above SELECT statement
>> >=== Either of these 2 would do the trick ===
>> >delete from pimitemflagrelation
>> >where not exists
>> > (select 1 from pimitemtable where pimitemtable.id =
>> >pimitemflagrelation.pimitem_id);
>> >
>> >delete from pimitemflagrelation
>> > where pimitemflagrelation.pimitem_id in (
>> > select pimitem_id
>> > from pimitemflagrelation
>> > left join
>> > pimitemtable
>> > on pimitemflagrelation.pimitem_id = pimitemtable.id);
>
> I personally prefer this (specifically the first version) for it's
> simplicity. We don't really care about performance in Janitor, so
> it does not matter how long it takes, as long as it's a reasonable
> timeframe.
Hi Dan,
Ugh, as I think about it, the performant SQL would be:
DELETE FROM pimitemflagrelation
LEFT JOIN pimitemtable
ON pimitemflagrelation.pimitem_id = pimitemtable.id
WHERE pimitemtable.id IS NULL;
I'm not sure whether MySQL supports a LEFT JOIN in the DELETE but you
should be able to give it a whirl. :)
Cheers,
--
Pablo Sanchez - Blueoak Database Engineering, Inc
Ph: 819.459.1926 Blog: http://pablo-blog.blueoakdb.com
iNum: 883.5100.0990.1054
_______________________________________________
KDE PIM users mailing list
Subscription management: https://mail.kde.org/mailman/listinfo/kdepim-users
More information about the kdepim-users
mailing list