Re: Performance of UPDATE operation

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: "Mkrtchyan, Tigran" <tigran(dot)mkrtchyan(at)desy(dot)de>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Performance of UPDATE operation
Date: 2023-02-13 21:49:15
Message-ID: CAMkU=1zHOaCep6X0HRUiupgEFKQ1d375vCR9fqoMWsZbptXPRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Feb 13, 2023 at 10:09 AM Mkrtchyan, Tigran <tigran(dot)mkrtchyan(at)desy(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Pavel Stehule 2023-02-14 05:53:54 Re: For loop execution times in PostgreSQL 12 vs 15
Previous Message Andres Freund 2023-02-13 21:21:57 Re: For loop execution times in PostgreSQL 12 vs 15