Re: Insert vs Update

From: Michael Nolan <htfoot(at)gmail(dot)com>
To: Robert DiFalco <robert(dot)difalco(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Insert vs Update
Date: 2015-07-15 20:53:10
Message-ID: CAOzAqu+UqrDXAqveH_PoK=6P2t28m3MSbem7ru0i5hoaACv5vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Jul 15, 2015 at 3:16 PM, Robert DiFalco <robert(dot)difalco(at)gmail(dot)com>
wrote:

>
> Thanks David, my example was a big simplification, but I appreciate your
> guidance. The different event types have differing amounts of related data.
> Query speed on this schema is not important, it's really the write speed
> that matters. So I was just wondering given the INSERT or UPDATE approach
> (with no indexed data being changed) if one is likely to be substantially
> faster than the other.
>
>
As I understand how ACID compliance is done, updating a record will require
updating any indexes for that record, even if the index keys are not
changing. That's because any pending transactions still need to be able to
find the 'old' data, while new transactions need to be able to find the
'new' data. And ACID also means an update is essentially a
delete-and-insert.
--
Mike Nolan

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message David G. Johnston 2015-07-15 21:14:42 Re: Insert vs Update
Previous Message Robert DiFalco 2015-07-15 19:49:31 Re: Insert vs Update