On Wed, 21 Feb 2024 at 17:07, Vladimir Sitnikov <sitnikov.vladi...@gmail.com> wrote: > From many measurements we know that insert into table(id, name) > values(?,?),(?,?),(?,?) is much more efficient than > sending individual bind-exec-bind-exec-bind-exec-sync messages like "insert > into table(id, name) values(?,?)" > For instance, here are some measurements: > https://www.baeldung.com/spring-jdbc-batch-inserts#performance-comparisons > Based on that measurements I assume there's a non-trivial per-message > overhead.
That's quite a different case. When splitting a multi insert statement you're going to duplicate some work, e.g. executor initialization and possibly even planning. But when replacing one Query packet with Parse-Bind-Exec-Sync, these 4 packets are not duplicating such expensive work. The only thing they should be doing extra is a bit of packet parsing, which is very cheap.