Hibernate multi row insert postgresql

拟墨画扇 提交于 2019-12-24 14:28:08

问题


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:


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.



来源:https://stackoverflow.com/questions/32121711/hibernate-multi-row-insert-postgresql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!