List:General Discussion« Previous MessageNext Message »
From:John McCaskey Date:August 31 2004 3:30pm
Subject:RE: INSERT IGNORE like feature for rows failing foreign key constraints?
View as plain text  
I never got a reply for this, and I'm still trying to figure out the
best way to handle it.  Anyone?

John A. McCaskey

-----Original Message-----
From: John McCaskey [mailto:johnm@stripped] 
Sent: Wednesday, August 25, 2004 2:17 PM
To: mysql@stripped
Subject: INSERT IGNORE like feature for rows failing foreign key
constraints?

I have a logging table where I insert a large number of rows every 5
minutes.  For performance reasons this occurs in bulk inserts of about
5000 rows at a time.  (ie. INSERT INTO table VALUES(...), (...), (...))

One of the fields in the table is an id that connects it to another
table.  It is possible that by the time the insert occurs (they queue up
in memory briefly before I create the bulk insert) a separate process
has deleted the entry in the parent table and the id is invalid.

When this happens right now the entire insert of 5000 rows fails because
one single row is bad.  I want the behavior to be that the one fails
silently and the other 4999 insert successfully.

Any ideas how I can do this?  It seems like INSERT IGNORE would make
sense but that appears to only ignore duplicates not foreign key
failures.

John A. McCaskey


 

Thread
INSERT IGNORE like feature for rows failing foreign key constraints?John McCaskey25 Aug
RE: INSERT IGNORE like feature for rows failing foreign key constraints?John McCaskey31 Aug