pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Dutcher <dave@tridecap.com>
To: 'PFC' <lists@peufeu.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: INSERT OU UPDATE WITHOUT SELECT?
Date: Tue, 30 May 2006 17:54:00 -0500
Message-ID: <039201c6843b$f11eeaf0$8300a8c0@tridecap.com> (raw)
In-Reply-To: <op.tadyc1jwcigqcu@apollo13>

What I do when I'm feeling lazy is execute a delete statement and then
an insert.  I only do it when I'm inserting/updating a very small number
of rows, so I've never worried if its optimal for performance.  Besides
I've heard that an update in postgres is similar in performance to a
delete/insert.


> -----Original Message-----
> From: pgsql-performance-owner@postgresql.org 
> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of PFC
> Sent: Tuesday, May 30, 2006 5:35 PM
> To: Jonah H. Harris; Waldomiro
> Cc: pgsql-performance@postgresql.org
> Subject: Re: [PERFORM] INSERT OU UPDATE WITHOUT SELECT?
> 
> 
> > PostgreSQL does not support MERGE at the moment, sorry.
> 
> 	Issue an UPDATE, and watch the rowcount ; if the 
> rowcount is 0, issue an  
> INSERT.
> 	Be prepared to retry if another transaction has 
> inserted the row  
> meanwhile, though.
> 
> 	MERGE would be really useful.
> 
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
> 




view thread (7+ messages)  latest in thread

Message-ID: <039201c6843b$f11eeaf0$8300a8c0@tridecap.com>
Permalink:  ../039201c6843b$f11eeaf0$8300a8c0@tridecap.com/
Also on:    postgresql.org/message-id/039201c6843b$f11eeaf0$8300a8c0@tridecap.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dave@tridecap.com, lists@peufeu.com
  Subject: Re: INSERT OU UPDATE WITHOUT SELECT?
  In-Reply-To: <039201c6843b$f11eeaf0$8300a8c0@tridecap.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox