MySQL Forums
Forum List  »  Newbie

Re: Looking up a value in a 'subtable' and inserting it if it doesn't exist
Posted by: Rick James
Date: May 02, 2009 12:42PM

Each INSERT and each SET is a round trip to the mysql server.
There is a way in the API you are using to avoid the round trip for
SET @camera = LAST_INSERT_ID():
PDO::lastInsertId()
mysql_insert_id()
mysqli->insert_id()

(Probably the performance details of these solutions is not enough to matter.)

Options: ReplyQuote




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.