Unix Technical Forum

Performance of REPLACE vs ON DUPLICATE KEY UPDATE

This is a discussion on Performance of REPLACE vs ON DUPLICATE KEY UPDATE within the MySQL forums, part of the Database Server Software category; --> Can anyone advise me on which has better performance: - REPLACE or - UPDATE ... ON DUPLICATE KEY UPDATE ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 10:04 AM
Andrew2006
 
Posts: n/a
Default Performance of REPLACE vs ON DUPLICATE KEY UPDATE

Can anyone advise me on which has better performance:

- REPLACE or
- UPDATE ... ON DUPLICATE KEY UPDATE

Many thanks

Andrew

http://dev.mysql.com/doc/refman/5.0/en/replace.html

http://dev.mysql.com/doc/refman/5.0/...duplicate.html

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 10:04 AM
Andrew2006
 
Posts: n/a
Default Re: Performance of REPLACE vs ON DUPLICATE KEY UPDATE

Sorry... That should have been:

INSERT ... ON DUPLICATE KEY UPDATE


On Feb 2, 10:58 am, "Andrew2006" <mymate...@googlemail.com> wrote:
> Can anyone advise me on which has better performance:
>
> - REPLACE or
> - UPDATE ... ON DUPLICATE KEY UPDATE
>
> Many thanks
>
> Andrew
>
> http://dev.mysql.com/doc/refman/5.0/en/replace.html
>
> http://dev.mysql.com/doc/refman/5.0/...duplicate.html



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 10:04 AM
Captain Paralytic
 
Posts: n/a
Default Re: Performance of REPLACE vs ON DUPLICATE KEY UPDATE

On 2 Feb, 11:01, "Andrew2006" <mymate...@googlemail.com> wrote:
> Sorry... That should have been:
>
> INSERT ... ON DUPLICATE KEY UPDATE
>
> On Feb 2, 10:58 am, "Andrew2006" <mymate...@googlemail.com> wrote:
>
>
>
> > Can anyone advise me on which has better performance:

>
> > - REPLACE or
> > - UPDATE ... ON DUPLICATE KEY UPDATE

>
> > Many thanks

>
> > Andrew

>
> >http://dev.mysql.com/doc/refman/5.0/en/replace.html

>
> >http://dev.mysql.com/doc/refman/5.0/...uplicate.html- Hide quoted text -

>
> - Show quoted text -


I don't know about performance, but they will do slightly different
things, especially with timestamp columns

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 10:04 AM
Andrew2006
 
Posts: n/a
Default Re: Performance of REPLACE vs ON DUPLICATE KEY UPDATE

There is some discussion on this on the web:

http://www.mysqlperformanceblog.com/...-replace-into/
Quote: "I do not have benchmarks with Innodb but I'd expect them to be
close. I'd mostly look at what makes more sense for your application
from development standpoint."

http://www.feedblog.org/2006/07/using_on_duplic.html
Quote: "Replace actually DELETEs and then INSERTS the row again which
causes 2x the IO."

On Feb 2, 11:01 am, "Andrew2006" <mymate...@googlemail.com> wrote:
> Sorry... That should have been:
>
> INSERT ... ON DUPLICATE KEY UPDATE
>
> On Feb 2, 10:58 am, "Andrew2006" <mymate...@googlemail.com> wrote:
>
> > Can anyone advise me on which has better performance:

>
> > - REPLACE or
> > - UPDATE ... ON DUPLICATE KEY UPDATE

>
> > Many thanks

>
> > Andrew

>
> >http://dev.mysql.com/doc/refman/5.0/en/replace.html

>
> >http://dev.mysql.com/doc/refman/5.0/...duplicate.html



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:13 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com