MySQL Forums
Forum List  »  Performance

Re: SELECT never completes
Posted by: Peter Brawley
Date: July 06, 2015 11:51PM

Left joins are expensive, indexes don't much help the left side. But A tbler index on (tblir,idtype,idet,preferred) might help, likewise a tblnx index on (idir,surname,order), in each case try it with and without the last column listed (they look like low-specificity columns). You'll have to experiment: put in an index, then run Explain Extended.

( (a && b ) or a ) is logically equivalent to ( a ), so simplify the Where clause to
tblNX.Surname='carruthers' and tblnx.order>=0.

Without indexes, joins across 3 tables with 50k rows each require the query engine to read
50k*50k*50k=125 trillion rows of data! Your query's number is 127k*62.5k*62, nearly 500 trillion. The query needs indexes but the engine can find none to use.

Options: ReplyQuote


Subject
Views
Written By
Posted
1592
July 06, 2015 10:08PM
Re: SELECT never completes
780
July 06, 2015 11:51PM
1246
July 07, 2015 02:16AM
746
July 09, 2015 12:55AM


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.