Closed gaeljw closed 1 year ago
Anorm is using addBatch
and executeBatch()
and so is compliant with JDBC semantics.
If you want to use INSERT INTO tbl (n rows ...)
as specific to some database, it's out of the JDBC batch features for me.
Ah I see, I didn't know this was specific to some databases and/or drivers. I agree this is not Anorm responsibility to implement this then. I will look a bit deeper at what my driver does and if there's a setting maybe (look's like some have a rewriteBatchedStatements
option).
Thanks @cchantep
Anorm Version (2.5.x / etc)
2.7.0
Expected Behavior
When using
BatchSql
for inserting multiple rows, I would expect Anorm to actually generate a singleINSERT
statement with several values rather than NINSERT
statements.In terms of performance, this can make a significative difference.
Actual Behavior
Anorm generates multiple
INSERT
statements.Workaround
A good workaround is described at https://stackoverflow.com/questions/24573242/batch-insert-with-table-that-has-many-columns-using-anorm
This is relatively easy to implement but this is kinda ugly.