membersound
membersound

Reputation: 86925

How to best load many database entries in single transaction?

I'm using Spring with Hibernate, and want to update a private cache 2-3 times a day. Each update will be having like 100.000 entries.

How could I best perform such operations? I have to execute this in a single transaction so that I do not have outdated and updates entries at once in the meantime of persisting the new data.

My database is SQL postres. Could you recommend on this?

Upvotes: 0

Views: 82

Answers (2)

Dariusz
Dariusz

Reputation: 22291

Depending on the complexity of processing, a good idea may be to update the cache using a stored procedure in postgres itself. It will give you the best performance possible. And all you have to do in your app is to call the procedure.

Upvotes: 0

Saket
Saket

Reputation: 3129

Hibernate has some recommendations for batch processing which may be useful for what you are trying to do.

Upvotes: 1

Related Questions