This page (Section 5.2.9: Speed of INSERT Queries) might be of interest:

http://www.mysql.com/doc/en/Insert_speed.html

You might also want to investigate the INSERT IGNORE command (IGNORE means ignore all inserts with duplicate unique keys), for example:

INSERT IGNORE
INTO your_table
(col1,col2,col3)
VALUES
(vala1,vala2,vala3),
(valb1,valb2,valb3),
(valc1,valc2,valc3)

See
http://www.mysql.com/doc/en/INSERT.html

for more info.

-steve


At 9:15 AM +0200 1/20/03, 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

---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

--
+------------------------------------------------------------------------+
| Steve Edberg                                      [EMAIL PROTECTED] |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| SETI@Home: 1001 Work units on 23 oct 2002                              |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens...  |
+------------------------------------------------------------------------+

---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to