Would it (the replace command) save me performance time instead of just
using insert and ignoring the mysql error ?
It looks like that insertion flow using the replace command would cost
Using insert --> insert , check for key existence & output an error
Using replace --> insert ,check for key existence, delete, insert
From: Daevid Vincent [mailto:daevid@stripped]
Sent: Monday, January 20, 2003 9:54 AM
To: 'Zysman, Roiy'; mysql@stripped
Subject: RE: What is the best known practice for insertion...?
This may be useful to you: http://www.mysql.com/doc/en/REPLACE.html
> -----Original Message-----
> From: Zysman, Roiy [mailto:roiy.zysman@stripped]
> Sent: Sunday, January 19, 2003 11:16 PM
> To: mysql@stripped
> Subject: What is the best known practice for insertion...?
> Hi All,
> I'm trying to insert multiple lines to a table with 3 col.
> All 3 of them
> are a part of the primary key.
> But while inserting the data , sometime occurs the situation where I
> want to insert an already exist entry with the same keys. And mysql
> barfs out that this key already exist in the table.
> The solution to it would be probably to query for each entry that I'm
> about to insert if that entry exists , but it looks like it
> would be an
> enormous overhead. I'm asking this question on a
> _performance_ context .
> What is the best way , ignore the error messages mysql barfs out or
> query each entry for existences before inserting it ?