Re: Fdw batch insert error out when set batch_size > 65535

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fdw batch insert error out when set batch_size > 65535
Date: 2021-05-30 19:51:54
Message-ID: fe6cea83-b378-dce0-0506-03ff9a1a581d@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I took at this patch today. I did some minor changes, mostly:

1) change the code limiting batch_size from

if (fmstate->p_nums > 0 &&
(batch_size * fmstate->p_nums > PQ_QUERY_PARAM_MAX_LIMIT))
{
batch_size = PQ_QUERY_PARAM_MAX_LIMIT / fmstate->p_nums;
}

to

if (fmstate && fmstate->p_nums > 0)
batch_size = Min(batch_size,
PQ_QUERY_PARAM_MAX_LIMIT / fmstate->p_nums);

which I think is somewhat clearer / more common patter.

2) I've reworded the docs a bit, splitting the single para into two. I
think this makes it clearer.

Attached is a patch doing this. Please check the commit message etc.
Barring objections I'll get it committed in a couple days.

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
0001-Make-sure-postgres_fdw-batching-does-use-too-many-pa.patch text/x-patch 5.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-05-30 20:05:21 Re: list of extended statistics on psql (\dX)
Previous Message Justin Pryzby 2021-05-30 17:24:18 Re: list of extended statistics on psql (\dX)