MySQL Forums
Forum List  »  Performance

Re: Deleting from a big table
Posted by: Øystein Grøvlen
Date: November 14, 2013 06:35AM

Hi Davide,

MySQL 5.6 significantly improved performance of IN-subqueries, but unfortunately these optimizations are not done for single-table UPDATE/DELETE statements. However, the optimizations are used for multi-table UPDATE/DELETE statements. Hence, I think that the following should give better performance if you are using MySQL 5.6:

DELETE BigTable FROM BigTable
WHERE pk IN
(SELECT pk FROM AnotherBigTable WHERE externalKey='abc');

The point is to use multi-table DELETE syntax for this single-table DELETE. Note that you must be using MySQL 5.6 or newer for this to improve performance.

I hope this helps,

Øystein Grøvlen,
Senior Principal Software Engineer,
MySQL Group, Oracle,
Trondheim, Norway

Options: ReplyQuote


Subject
Views
Written By
Posted
1742
November 14, 2013 02:27AM
Re: Deleting from a big table
845
November 14, 2013 06:35AM
800
November 14, 2013 05:56PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.