On Monday 20 January 2003 12:15 am, Zysman, Roiy wrote:
> 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 ?
Roiy:
Try INSERT IGNORE...
--
MySQL Development Team
For technical support contracts, visit https://order.mysql.com/?ref=mspa
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sasha Pachev <sasha@stripped>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, http://www.mysql.com/
/_/ /_/\_, /___/\___\_\___/ Provo, Utah, USA
<___/
MySQL Users Conference and Expo
http://www.mysql.com/events/uc2003/

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.