MySQL Forums :: Performance :: Slow Query, Optimization Advice Needed


Advanced Search

Re: Slow Query, Optimization Advice Needed
Posted by: Øystein Grøvlen ()
Date: April 28, 2016 01:25AM

Hi,

It is true that many IN-subqueries perform bad in MySQL 5.5 and earlier. However, I would expect for this particular query that MySQL 5.6 will use the semi-join FirstMatch strategy. That is basically the same strategy as used in earlier MySQL versions. It is pretty efficient in this case since an index can be used to check for matches.

The advantage of semi-join shows when you can either benefit from materializing the inner query, or process the tables in a different order. The former is not possible here since the subquery is dependent on the outer query (it refers to a column of the outer query.) The latter will usually only be an advantage when there is some conditions in the WHERE clause of the inner query that can be applied before the join.

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

Options: ReplyQuote


Subject Views Written By Posted
Slow Query, Optimization Advice Needed 726 Michael Lawson 04/26/2016 09:30AM
Re: Slow Query, Optimization Advice Needed 353 Øystein Grøvlen 04/27/2016 01:02AM
Re: Slow Query, Optimization Advice Needed 412 Michael Lawson 04/27/2016 07:20PM
Re: Slow Query, Optimization Advice Needed 359 Peter Brawley 04/27/2016 11:28PM
Re: Slow Query, Optimization Advice Needed 338 Øystein Grøvlen 04/28/2016 01:25AM
Re: Slow Query, Optimization Advice Needed 343 Rick James 05/01/2016 11:47PM
Re: Slow Query, Optimization Advice Needed 351 Øystein Grøvlen 05/02/2016 01:28AM
Re: Slow Query, Optimization Advice Needed 348 Øystein Grøvlen 04/28/2016 01:12AM


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.