Re: Performance of UPDATE operation

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Performance of UPDATE operation
Дата
Msg-id CAMkU=1zHOaCep6X0HRUiupgEFKQ1d375vCR9fqoMWsZbptXPRQ@mail.gmail.com
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: For loop execution times in PostgreSQL 12 vs 15
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: For loop execution times in PostgreSQL 12 vs 15