Re: Performance of UPDATE operation - Mailing list pgsql-performance

From Jeff Janes
Subject Re: Performance of UPDATE operation
Date
Msg-id CAMkU=1zHOaCep6X0HRUiupgEFKQ1d375vCR9fqoMWsZbptXPRQ@mail.gmail.com
Whole thread Raw
List pgsql-performance
On Mon, Feb 13, 2023 at 10:09 AM Mkrtchyan, Tigran <tigran.mkrtchyan@desy.de> wrote:

         0.524           0  BEGIN;
         0.819           0  INSERT INTO t_inodes (inumber, icrtime, igeneration)
         0.962           0  UPDATE t_inodes SET igeneration = igeneration + 1 where  inumber = :inumber;
         9.203           0  END;
```

My naive expectation will be that updating the newly inserted record should cost nothing

It takes less than 1/10 of the total time.  That is pretty close to nothing.  Why would you expect it to be truly free? 
 
... Are there ways
to make it less expensive?

Obviously here you could just insert the correct value in the first place and not do the update at all.

Cheers,

Jeff

pgsql-performance by date:

Previous
From: Andres Freund
Date:
Subject: Re: For loop execution times in PostgreSQL 12 vs 15
Next
From: Pavel Stehule
Date:
Subject: Re: For loop execution times in PostgreSQL 12 vs 15