Re: Does update = delete + insert ?

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: Steve Atkins <steve(at)blighty(dot)com>, pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Does update = delete + insert ?
Date: 2010-05-26 19:14:37
Message-ID: 482E80323A35A54498B8B70FF2B879800458C31081@azsmsx504.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ohhhh.. Yes, I forgot about the triggers.
Good call !!! This table has lots of triggers.

Thanks for reminding me of this!!!

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Steve Atkins
Sent: Wednesday, May 26, 2010 3:05 PM
To: pgsql-general General
Subject: Re: [GENERAL] Does update = delete + insert ?

On May 26, 2010, at 11:41 AM, Gauthier, Dave wrote:

> Hi:
>
> Under the hood, does PG implement an update statement as a delete followed by an insert? I'm at a point in coding a script where it would be more expeditious for me to delete/insert a record as opposed to update and want to know if I lose anything by doing that.

As far as writes to the table are concerned, yes they're pretty much the same.

If there are triggers on the table, though, they may see the two actions differently.

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2010-05-26 20:12:31 Re: cursor_to_xml iteration of a table
Previous Message Steve Atkins 2010-05-26 19:04:54 Re: Does update = delete + insert ?