You can define unique keys

CREATE TABLE MyTable (
X char(50),
Y char(25),
Z char(15),
Count_ int(11),
 INDEX X (X),
 INDEX Y (Y),
 UNIQUE XY (X,Y));

and use a sql like INSERT IGNORE INTO MyTable VALUES(X,Y,Z) keep in mind
that the keys will grow fast.

The IGNORE stops error messages when the unique condition exists

Then you can update...

UPDATE MyTable set count_ = count_ + 1 WHERE X = ? and Y = ?

This is much faster than search, add/or update.

Butch

-----Original Message-----
From: Priya Ramkumar [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 22, 2001 6:01 AM
To: [EMAIL PROTECTED]
Subject: faster inserts & updates


Hi

I have a PHP program which adds records to a MySQL table. The number of
records in the table after the execution of the program is around 28,000. I
also have select & update queries in the program on the same table. The
process takes a very long time to complete all insertions to the table. I
already tried "Insert Delayed" on a sample segment of data but found that it
does not speed up things. Can anyone suggest a method  so that the
insertions & updates to the table can be faster?

Thanks for any help.

Regards,
Priya







---------------------------------------------------------------------
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



---------------------------------------------------------------------
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