Re: foreign table batch inserts

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Manuel Kniep <m(dot)kniep(at)web(dot)de>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: foreign table batch inserts
Date: 2016-06-01 05:58:09
Message-ID: 75cbd98b-8896-60c9-71dc-2a063fe3d36a@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2016/05/31 14:53, Amit Langote wrote:
> On 2016/05/30 22:59, Craig Ringer wrote:
>> On 30 May 2016 at 16:17, Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> wrote:

>>> That's a good point, but the basic idea is to send the local query
>>> almost-as-is to the remote server if possible. For example, if the local
>>> query is "INSERT INTO foreign_table(a,b,c) VALUES (1, 2, 3), (4, 5, 6)",
>>> send the remote query "INSERT INTO remote_table(a,b,c) VALUES (1, 2, 3),
>>> (4, 5, 6)" to the remote server where remote_table is the table name for
>>> the foreign table on the remote server. So, wouldn't the query string
>>> length be a problem in many cases? Maybe I'm missing something, though.
>>> <http://www.postgresql.org/mailpref/pgsql-hackers>

>> FDWs don't operate at that level. They don't see the original query string.
>> They're plan nodes that operate with a row-by-row push/pull model. The
>> foreign table node in question has no idea you're doing a multivalued
>> insert and doesn't care if it's INSERT INTO ... SELECT, INSERT INTO ...
>> VALUES, or COPY.

> IIUC, what Fujita-san seems to be referring to here is safe push-down of a
> insert's query or values expression (and hence the whole insert itself)
> considered during the *planning* step.

That's really what I have in mind. Thanks for the explanation!

> Although that sounds like a
> different optimization from what's being discussed on this thread. The
> latter certainly seems to have its benefits in case of push-down failure
> and might as well be the majority of cases.

Agreed.

Best regards,
Etsuro Fujita

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2016-06-01 06:09:43 Re: Parallel pg_dump's error reporting doesn't work worth squat
Previous Message Craig Ringer 2016-06-01 05:43:22 Re: Question and suggestion about application binary compatibility policy