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
sounds like a database problem. check your tables if they use InnoDB or MyISAM, the latter is in my experience very slow with insert and is the default for new dbs. remove foreign keys as far as you can
If your problem really is related to a single unique index InnoDB could do the trick.
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.