Hibernate multi row insert postgresql

2019-08-10 11:47发布

Now I have working batch inserts with hibernate ("hibernate.jdbc.batch_size = 50) but as far as i know hibernate generates single inserts in batches. I know that I can tell my db driver to create multi-row insert for every batch of inserts to speed up performance using rewriteBatchedStatements: jdbc:postgresql://localhost:5432/mydb?rewriteBatchedStatements=true

But in db logs there are still single inserts. What am I doing wrong? Thanks.

1条回答
Animai°情兽
2楼-- · 2019-08-10 12:15

This actually has nothing to do with Hibernate. The inserts are handled by the JDBC driver.

rewriteBatchedStatements is a MySQL specific parameter so it won't work with a PostgreSQL database. If you really need to do bulk inserts with PostgreSQL, take a look at this other answer which explains how to do it.

查看更多
登录 后发表回答