Re: MERGE vs REPLACE - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: MERGE vs REPLACE
Date
Msg-id 20051116193322.GN31063@svana.org
Whole thread Raw
In response to Re: MERGE vs REPLACE  ("Dann Corbit" <DCorbit@connx.com>)
Responses Re: MERGE vs REPLACE
List pgsql-hackers
On Wed, Nov 16, 2005 at 11:06:15AM -0800, Dann Corbit wrote:
> > -----Original Message-----
> > From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-
> > owner@postgresql.org] On Behalf Of Simon Riggs
> > > Conceptually, a MERGE statement is just a long string of INSERTs and
> > > UPDATEs in the same transaction and I think we should treat it as
> > > such.
>
> Merge could also be considered as a long string of deletes and inserts.
> I guess that deleting those records that already exist and then
> inserting all of the records is faster because it could be done like a
> single join to perform the delete and then a single batch insert.

And for us it makes no difference because in MVCC, UPDATE == DELETE +
INSERT. IMHO it's just a nice construct to specify UPDATEs and INSERTs
in the same statement.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Some array semantics issues
Next
From: Greg Stark
Date:
Subject: Re: Some array semantics issues