MySQL Forums
Forum List  »  Optimizer & Parser

Re: bulk update very slow
Posted by: Jørgen Løland
Date: September 27, 2012 12:01PM

Hi James,

There could be a number of reasons for this execution time difference between SELECT and UPDATE.

First, UPDATE statements are sometimes not equally well optimized as SELECT statements. It happens that MySQL is able to make a great execution plan for SELECTs but not for similar UPDATEs. This may be the case here.

Second, SELECT statements don't have to lock rows in InnoDB while UPDATE statements do. Do you have any other UPDATE or DELETE statements running concurrently? If you do, there may be locking conflicts (although the transaction should time out long before 5 minutes).

I assume you don't run MySQL 5.6? If you do (or if you have a chance to install that server version and try your query), you can run EXPLAIN for the UPDATE and provide the details so we can help you more easily. Otherwise it may help to show us the output of EXPLAIN for the SELECT.

Hope this helps,
Jørgen Løland
Software Engineer, MySQL, Oracle
jorgenloland.blogspot.com

Options: ReplyQuote


Subject
Views
Written By
Posted
4967
September 25, 2012 02:51PM
1924
September 26, 2012 02:58PM
Re: bulk update very slow
3305
September 27, 2012 12:01PM
2003
September 27, 2012 08:19PM


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.