MySQL: Is it faster to use inserts and updates instead of insert on duplicate key update?

Posted by Nir on Stack Overflow See other posts from Stack Overflow or by Nir
Published on 2010-03-22T21:37:42Z Indexed on 2010/03/22 21:41 UTC
Read the original article Hit count: 254

I have a cron job that updates a large number of rows in a database. Some of the rows are new and therefore inserted and some are updates of existing ones and therefore update.

I use insert on duplicate key update for the whole data and get it done in one call.

But- I actually know which rows are new and which are updated so I can also do inserts and updates seperately.

Will seperating the inserts and updates have advantage in terms of performance? What are the mechanics behind this ?

Thanks!

© Stack Overflow or respective owner

Related posts about mysql

Related posts about mysql-query