From: Vladislav Malyshkin <mal@gromco.com>
To: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-jdbc@lists.postgresql.org <pgsql-jdbc@lists.postgresql.org>
Subject: Re: JDBC prepared statement: a 32767 limit of arguments number
Date: Thu, 10 Mar 2022 11:55:39 -0500
Message-ID: <61f81ae4-d1fd-9331-3b48-b957ff5fc741@gromco.com> (raw)
In-Reply-To: <CAB=Je-G7Xa9KR_sMYuO7TKOURjT7wQ7rdbn-k0trSebMNaaYhg@mail.gmail.com>
References: <e83c908e-219f-ff45-c9cc-01f47d8f5d76@gromco.com>
<CAKFQuwa69nCWZmm=wwLMd2Wwr9m36uYDU0BbwfVTOV-0h0+esw@mail.gmail.com>
<515148.1646838226@sss.pgh.pa.us>
<bb23919c-fc6d-d4db-541d-d051b1db491a@gromco.com>
<CAKFQuwYeZpr7c6TqmSPznTAAygB6yQ=q2yFQfc+pMf=YHKs=5Q@mail.gmail.com>
<b676fc7e-0c3a-1c57-0d73-2f02a7fc8b37@gromco.com>
<CAKFQuwaJUe-fpLRiY3hNrMeH7A1AOu8coOZ+Bfh6cMJRBuhSLw@mail.gmail.com>
<CAB=Je-G7Xa9KR_sMYuO7TKOURjT7wQ7rdbn-k0trSebMNaaYhg@mail.gmail.com>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 10/03/2022 04.08, Vladimir Sitnikov
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAB=Je-G7Xa9KR_sMYuO7TKOURjT7wQ7rdbn-k0trSebMNaaYhg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr"><br>
<div>Have you tried PreparedStatement#addBatch + #executeBatch
APIs and reWriteBatchedInserts=true connection option?</div>
<div>It might yield the expected speedup without resorting to
PG-specific APIs and syntax like COPY.</div>
<br>
</div>
</blockquote>
<br>
Yes, I tried addBatch + executeBatch. It was very inconvenient in my
specific case. I used all over the place postgresql extension<br>
<br>
insert into table(c1, c2, c3, ...) values (....) RETURNING *<br>
<br>
this way I can "get back" the data inserted. The PG extension
INSERT/UPDATE/DELETE ... RETURNING *<br>
was so convenient to: 1. check the data, 2. autoincrements, 3.
Return updated data, etc, that I started to use in with almost all
insert/update/delete.<br>
The #executeBatch returns the number of rows changed, not the data
as with the RETURNING *<br>
<br>
Vladislav <font size="+1"><br>
</font>
</body>
</html>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: mal@gromco.com, sitnikov.vladimir@gmail.com, david.g.johnston@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: JDBC prepared statement: a 32767 limit of arguments number
In-Reply-To: <61f81ae4-d1fd-9331-3b48-b957ff5fc741@gromco.com>
References: <e83c908e-219f-ff45-c9cc-01f47d8f5d76@gromco.com> <CAKFQuwa69nCWZmm=wwLMd2Wwr9m36uYDU0BbwfVTOV-0h0+esw@mail.gmail.com> <515148.1646838226@sss.pgh.pa.us> <bb23919c-fc6d-d4db-541d-d051b1db491a@gromco.com> <CAKFQuwYeZpr7c6TqmSPznTAAygB6yQ=q2yFQfc+pMf=YHKs=5Q@mail.gmail.com> <b676fc7e-0c3a-1c57-0d73-2f02a7fc8b37@gromco.com> <CAKFQuwaJUe-fpLRiY3hNrMeH7A1AOu8coOZ+Bfh6cMJRBuhSLw@mail.gmail.com> <CAB=Je-G7Xa9KR_sMYuO7TKOURjT7wQ7rdbn-k0trSebMNaaYhg@mail.gmail.com> <61f81ae4-d1fd-9331-3b48-b957ff5fc741@gromco.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox