'Optimizing save time for bulk save in spring data jpa

I have a use-case(most common i guess), where i have to insert 300k records, which is everyday refresh, i have used spring jpa save (using batch), currently it is taking more than 1hr to save all records.

I have used batching, but it dint helped much, database is mariadb is there any better approach for this optimize save time.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source