MySQL Forums
Forum List  »  InnoDB

Fast Insert Where Not Exist
Posted by: Ferdie Palero
Date: December 01, 2016 07:58PM

Hi,

Anyone can help on how this insert where not exist faster, currently the sql statement below working but it takes 1hour 42minutes for 65k records.

INSERT INTO exclusive (lname,fname,mname,address,city,state,zip)
SELECT lname,fname,mname,address,city,state,zip
FROM exclusive_temp a
WHERE NOT EXISTS (SELECT lname,fname,mname,address,city,state,zip
FROM exclusive b
where concat(a.lname,a.fname,a.mname,a.address,a.city,a.state,a.zip) = concat(b.lname,b.fname,b.mname,b.address,b.city,b.state,b.zip)
and b.deleted_date is null)
group by a.lname,a.fname,a.mname,a.address,a.city,a.state,a.zip;

Thanks in Advanced.

Regards,
FPalero

Options: ReplyQuote


Subject
Views
Written By
Posted
Fast Insert Where Not Exist
1456
December 01, 2016 07:58PM
689
December 01, 2016 09:01PM
878
December 01, 2016 11:00PM
698
December 02, 2016 12:08AM
743
December 02, 2016 12:24AM


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.