On 09/03/2022 10.03, Tom Lane wrote:
I concur with David's opinion that if you think you need more
parameters, you're doing it wrong. One idea to consider is
aggregating similar values into an array parameter.
I disagree:
1. It is extremely convenient to insert multiple values in a
single SQL insert:
INSERT INTO table_name (f1,f2,f3) VALUES (1,"text",2.4),
(2,"text2",2.5),...
Setting all values as JDBC parameters is the easiest way to
integrate java/scala and SQL.
A single insert of 10000 records is several orders of magnitudes
faster
than 10000 separate inserts, not to mention transaction
simplification.
2. For automatic scala<->jdbc integration tools such as
https://github.com/mal19992/sqlps
a number of JDBC arguments can be generated by an automatic
transformation, the SQL and JDBC arguments are autogenerated and
can be a very large number.
Suggested by David approach "like using a temp table and a join
instead of an IN operator." is extremely inconvenient for
automatic tools.
Vladislav