Lists: | pgsql-general |
---|
From: | "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Does update = delete + insert ? |
Date: | 2010-05-26 18:41:16 |
Message-ID: | 482E80323A35A54498B8B70FF2B879800458C31048@azsmsx504.amr.corp.intel.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
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.
Thanks in Advance !
From: | Andreas Kretschmer <akretschmer(at)spamfence(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Does update = delete + insert ? |
Date: | 2010-05-26 18:50:16 |
Message-ID: | 20100526185016.GA6757@tux |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Gauthier, Dave <dave(dot)gauthier(at)intel(dot)com> 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
Yes, Update means delete the old record and create a new one.
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
From: | Steve Atkins <steve(at)blighty(dot)com> |
---|---|
To: | pgsql-general General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Does update = delete + insert ? |
Date: | 2010-05-26 19:04:54 |
Message-ID: | 6AC6AD90-9779-47AB-9950-40016E9F7E0A@blighty.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
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
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 |
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