I am using the database native sequence generator using following tags in hibernate hbm file:
<id name=“contactId” column=“contact_id”>
I run an import job to import records in that table. The records are in the order of several thousands to even million. The performance of import is slow so when I use the SQL server Query Store to analyze queries fired on the database, I see that the select next value from the sequence is getting executed as many times as the number of records to be imported plus there are some more supporting queries related to sequence which are getting executed as many times as well.
I guess this is one of the reasons the import job is slow.
- Are there any ways to optimize this?
- Will using an application generated identifier (and avoiding database sequence generator) improve the performance of import job?