Re: Optimization for updating foreign tables in Postgres FDW

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimization for updating foreign tables in Postgres FDW
Date: 2016-04-08 07:05:37
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2016/04/08 13:42, Noah Misch wrote:
> On Tue, Apr 05, 2016 at 03:22:03PM +0900, Etsuro Fujita wrote:
>> On 2016/04/04 20:35, Michael Paquier wrote:
>>> On Mon, Apr 4, 2016 at 7:49 PM, Etsuro Fujita
>>> <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>>>> Here is a patch to fix this issue. As proposed by Michael, I modified
>>>> execute_dml_stmt so that it uses PQsendQueryParams, not PQexecParams. Any
>>>> comments are welcome.

>>> + * This is based on pqSocketCheck.
>>> + */
>>> + bool
>>> + CheckSocket(PGconn *conn)
>>> + {
>>> + int ret;
>>> +
>>> + Assert(conn != NULL);
>>> Instead of copying again pqSocketQuery, which is as well copied in
>>> libpqwalreceiver.c, wouldn't it be better to use WaitLatchOrSocket
>>> with the socket returned by PQsocket?

>> Will check. Thanks for the comment!

> What do you think? This open item's seven-day deadline has passed. It would
> help keep things moving to know whether you consider your latest patch optimal
> or whether you wish to change it the way Michael described.

I wish to change it that way because it not only avoids the duplicate
but fixes a bug in the previous patch that I overlooked that there is a
race condition if a signal arrives just before entering the CheckSocket.

Attached is an updated version of the patch.

Sorry for the delay.

Best regards,
Etsuro Fujita

Attachment Content-Type Size
pgfdw-direct-modify-v2.patch text/x-patch 3.4 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2016-04-08 07:37:05 Re: Speed up Clog Access by increasing CLOG buffers
Previous Message Michael Paquier 2016-04-08 06:48:11 Re: BUG #13755: pgwin32_is_service not checking if SECURITY_SERVICE_SID is disabled