Re: POC: Lock updated tuples in tuple_update() and tuple_delete()

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Chris Travers <chris(dot)travers(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: POC: Lock updated tuples in tuple_update() and tuple_delete()
Date: 2023-03-27 10:49:22
Message-ID: CAPpHfdun_qexYDud7q=eBxHF7Xsddq681i_k_xu4RyqCzPd8WQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

On Fri, Mar 24, 2023 at 3:39 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2023-03-23 23:24:19 +0300, Alexander Korotkov wrote:
> > On Thu, Mar 23, 2023 at 8:06 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > > I seriously doubt that solving this at the tuple locking level is the right
> > > thing. If we want to avoid refetching tuples, why don't we add a parameter to
> > > delete/update to generally put the old tuple version into a slot, not just as
> > > an optimization for a subsequent lock_tuple()? Then we could remove all
> > > refetching tuples for triggers. It'd also provide the basis for adding support
> > > for referencing the OLD version in RETURNING, which'd be quite powerful.

After some thoughts, I think I like idea of fetching old tuple version
in update/delete. Everything that evades extra tuple fetching and do
more of related work in a single table AM call, makes table AM API
more flexible.

I'm working on patch implementing this. I'm going to post it later today.

------
Regards,
Alexander Korotkov

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema 2023-03-27 11:50:39 Re: [EXTERNAL] Support load balancing in libpq
Previous Message Alexander Pyhalov 2023-03-27 10:28:24 Re: CREATE INDEX CONCURRENTLY on partitioned index