Re: Optimization for updating foreign tables in Postgres FDW

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>, Thom Brown <thom(at)linux(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-19 03:45:39
Message-ID: 5715A9E3.9030207@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2016/04/19 12:26, Michael Paquier wrote:
> On Tue, Apr 19, 2016 at 12:16 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
>> On Sat, Apr 16, 2016 at 08:59:40AM +0900, Michael Paquier wrote:

>>> Here is a new version. I just recalled that I forgot a PQclear() call
>>> to clean up results.

Thanks for updating the patch!

>> Robert, the deadline to fix this open item expired eleven days ago. The
>> thread had been seeing regular activity, but it has now been quiet for three
>> days. Do you have an updated plan for fixing this open item?

> Note for Robert: pgfdw_get_result copycats PQexec by discarding all
> PQresult received except the last one. I think that's fine for the
> purposes of postgres_fdw, but perhaps you have a different opinion on
> the matter.

That seemed reasonable to me, but sorry, on second thought, I'm not sure
that's still a good idea. One reason is (1) I think it's better for the
in-postgres_fdw.c functions using pgfdw_get_result to verify that there
are no more results, in itself. I think that would improve the
robustness of those functions. Another reason is I don't think
pgfdw_report_error, which is used in pgfdw_get_result, works well for
cases where the query contains multiple SQL commands. So, +1 for the
idea of simply encapsulating the while (PQisBusy(...)) loop into a new
function pgfdw_get_result().

Best regards,
Etsuro Fujita

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-04-19 03:56:55 Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees.
Previous Message Michael Paquier 2016-04-19 03:26:47 Re: Optimization for updating foreign tables in Postgres FDW