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

Поиск
Список
Период
Сортировка
От Bharath Rupireddy
Тема Re: Fdw batch insert error out when set batch_size > 65535
Дата
Msg-id CALj2ACUxf+PRaTVPEY-pV_nNgsB0_U2uU3u8GqMKcF-6M2exjw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Fdw batch insert error out when set batch_size > 65535  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Ответы Re: Fdw batch insert error out when set batch_size > 65535  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Список pgsql-hackers
On Mon, May 31, 2021 at 1:21 AM Tomas Vondra
<tomas.vondra@enterprisedb.com> wrote:
>
> 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.

Agree, that looks pretty good.

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

LGTM, except one thing that the batch_size description says "should
insert in", but it's not that the value entered for batch_size is
always honoured right? Because this patch might it.

       This option specifies the number of rows
<filename>postgres_fdw</filename>
       should insert in each insert operation. It can be specified for a

So, I suggest to remove "should" and change it to:

       This option specifies the number of rows
<filename>postgres_fdw</filename>
       inserts in each insert operation. It can be specified for a

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

One minor comment:
In the commit message, Int16 is used
The FE/BE protocol identifies parameters with an Int16 index, which
limits the maximum number of parameters per query to 65535. With

and in the code comments uint16 is used.
+     * parameters in a batch is limited to 64k (uint16), so make sure we don't

Isn't it uint16 in the commit message too? Also, can we use 64k in the
commit message instead of 65535?

With Regards,
Bharath Rupireddy.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: pg_get_wal_replay_pause_state() should not return 'paused' while a promotion is ongoing.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Multiple hosts in connection string failed to failover in non-hot standby mode