MySQL Forums
Forum List  »  Newbie

Re: Query never finishes
Posted by: Peter Brawley
Date: June 24, 2015 09:28PM

> identify which objects are in table A that are not in table B

`a` left join `b` requires that all join-relevant values in `a` be examined. Run Explain Extended on your query to see what if any index the optimiser can find for the left side.

If you can't speed your query up, there's probably something wrong with your setup. Until you fix that, you can fiddle a workaround: give `a` and `b` auto_increment primary keys, then ...

create table a_in_b
select a.pk
from a
join b on a.val1=b.vala;

Now the primary key values which are in `a` and not in `a_in_b` are the pks of your unmatched rows.

Options: ReplyQuote


Subject
Written By
Posted
Re: Query never finishes
June 24, 2015 09:28PM


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.