Re: Skip adding row-marks for non target tables when result relation is foreign table.

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: SAIKIRAN AVULA <avulasaikiranreddy(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Skip adding row-marks for non target tables when result relation is foreign table.
Date: 2024-08-09 08:35:11
Message-ID: CAPmGK16H_iHhuwOe_LV4Q2eDnToaU_fFfb21ttB1fS9zBWvLig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, May 22, 2024 at 10:13 AM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> On Mon, 2024-05-06 at 23:10 +0100, SAIKIRAN AVULA wrote:
> > Additionally, the commit afb9249d06f47d7a6d4a89fea0c3625fe43c5a5d,
> > which introduced late locking for foreign tables, mentions that the
> > benefits of late locking against a remote server are unclear, as the
> > extra round trips required are likely to outweigh any potential
> > concurrency improvements.
>
> The extra round trip only happens when EPQ finds a newer version of the
> tuple, which should be the exceptional case. I'm not sure how this
> balances out, but to me late locking still seems preferable. Early
> locking is a huge performance hit in some cases (locking many more rows
> than necessary).

I might be missing something, but I think the extra round trip happens
for each foreign row locked using the RefetchForeignRow() API in
ExecLockRows(), so I think the overhead is caused in the normal case.

> Early locking is also a violation of the documentation here:
>
> "When a locking clause appears at the top level of a SELECT query, the
> rows that are locked are exactly those that are returned by the query;
> in the case of a join query, the rows locked are those that contribute
> to returned join rows."

Yeah, but I think this holds true for SELECT queries postgres_fdw
sends to the remote side. :)

Best regards,
Etsuro Fujita

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2024-08-09 08:49:41 Re: Cross-version Compatibility of postgres_fdw
Previous Message Michael Banck 2024-08-09 08:24:00 Re: Improve error message for ICU libraries if pkg-config is absent