MySQL Forums
Forum List  »  InnoDB

Re: Update query Crashes the server
Posted by: Rick James
Date: April 10, 2013 10:01PM

PLEASE file bugs in both places mentioned in the log.

Meanwhile, "IN ( SELECT ... )" is terribly inefficient until 5.6; suggest something more like:

UPDATE  `news`
    JOIN  
      ( SELECT  DISTINCT gallery_id
            FROM  gallery
            WHERE  app_status IN ('A', 'N') ) x
    ON x.gallery_id = news.guid
    SET news.`app_status` = 'D',
        news.`load_status` = 'D'
    WHERE  news.feed_id !=21

news needs an index on guid if it does not already have one.

Is DISTINCT really needed? If not, then the query can be further simplified (and optimized).

Options: ReplyQuote


Subject
Views
Written By
Posted
2476
April 09, 2013 09:44AM
Re: Update query Crashes the server
723
April 10, 2013 10:01PM


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.