DB/Schema: Correct use of indexes on mail_items table. Prevents deadlocks in operations on this table.

This commit is contained in:
Machiavelli committed 2011-05-29 00:32:18 +02:00
1 parent 4fe5388be8
commit f8bd56e219
2 files changed
+10 -2

No files matched your search

@@ -0,0 +1,7 @@
-- Uncomment this query if the second query gives you primary key violation errors
-- DELETE FROM `mail_items` WHERE `item_guid` IN (SELECT `item_guid` FROM `mail_items` GROUP BY `item_guid` HAVING COUNT(`item_guid`) > 1);
ALTER TABLE `mail_items`
DROP PRIMARY KEY,
ADD PRIMARY KEY(`item_guid`),
ADD KEY `idx_mail_id` (`mail_id`);