Improve insert performance massively

后端 未结 2 1393
误落风尘
误落风尘 2021-01-04 17:55

In my application I need to massively improve insert performance. Example: A file with about 21K records takes over 100 min to insert. There are reasons it can takes some ti

2条回答
  •  旧巷少年郎
    2021-01-04 18:51

    see

    spring-data JPA: manual commit transaction and restart new one

    Add entityManager.flush() and entityManager.clear() after every n-th call to save() method. If you use hibernate add hibernate.jdbc.batch_size=100 which seems like a reasonable choice.

    Performance increase was > 10x, probably close to 100x.

提交回复
热议问题