New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce bulk updaters/inserters/deleters #539
Comments
One way of implementing this feature would be to introduce an API like this:
Another way would be:
|
Benchmark of different solutions: https://stackoverflow.com/questions/11389449/performance-of-mysql-insert-statements-in-java-batch-mode-prepared-statements-v |
Hello, One addition: BulkOptions may be optional ... and may hold (future) settings for bulk insertion tuning. You could transparently switch to this mode, when:
|
wouldn't it be a lot cleaner to use a sort of transactions setup for this? This is, if I remember correctly, the way JPA and Hibernate do it. It gets the same results, the statements are only passed to the database when all statements are done. But it seems more in line with how these sorts of things work when you look at the database itself. Using the transaction setup means that the actual database actions can be done in different locations in your code. which makes for cleaner code in my opinion. When using transactions, we could even keep track of all updates / inserts / deletes performed so we could reverse them in case one of the later ones fails to commit. But this would be a nice to have feature in the short term. very basic example: |
@ractoc interestingly the imminent version of Speedment will support transactions in a similar way you describe it. We could ask @Rei-Sundance to test the performance with a transaction based insert once 3.0.17 is released. Example:
|
cool, looking forward to seeing that. A feature like this brings us one step closer to actually being able to use speedment in high end production environments |
Currently, the
Manager::updater
,Manager::inserter
andManager::deleter
handle operations on a one-by-one case. It would be beneficial to introduce bulk update methods that could handle multiple operations in a single SQL operation.The text was updated successfully, but these errors were encountered: