MySQL Forums
Forum List  »  InnoDB

Re: Update a row or insert if don´t exist
Posted by: Armin
Date: June 09, 2005 12:24AM

Hi,

I have the same problem with PHP. (Data synchronisation dBase-File to MySQL)
Did you find a solution?

At them moment I submit a SELECT to the Server.
--> "SELECT `products_id` FROM `" . $ASE_DBTABL_PROD . "` WHERE `products_dist` LIKE '" . $DIST . "' AND `products_anr` LIKE '" . $DIST . $products_anr . "' LIMIT 0 , 1";
If there are rows matching that query I sumit a UPDATE.
--> "UPDATE `" . $ASE_DBTABL_PROD . "` SET `products_hnr` = '" . $products_hnr . "' WHERE `products_dist` LIKE '" . $DIST . "' AND `products_anr` LIKE '" . $DIST . $products_anr . "'"
Otherwise I Submit an INSERT.
--> "INSERT INTO `" . $ASE_DBTABL_PROD . "` (`products_dist`) VALUES ('" . $DIST . "')"

But that stresses the server! MySQL needs 99% cpu for about 3-4 hours!
That SQL-Table has 32.000 rows with 27 Fields.

Knows anybody an other way to do this and get a better performance?

Thanks,
Armin

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Update a row or insert if don´t exist
4435
June 09, 2005 12:24AM


Sorry, you can't reply to this topic. It has been closed.

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.