-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
knex.batchInsert #1182
knex.batchInsert #1182
Conversation
@@ -647,6 +647,37 @@ module.exports = function(knex) { | |||
}); | |||
}); | |||
|
|||
|
|||
it('#757 - knex.batchInsert(tableName, bulk, chunkSize)', function (done) { | |||
this.timeout(20000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure that batch insert does what it is supposed to dataset could be e.g. 100 items, which are added in batch of 30 items or so? We need to avoid long running tests.
@wubzz thaks for PR, I left few comments on the code. Also documentation should be added for the new feature. The long running test was the only serious issue in the code. Other stuff are more just opinions :) |
@elhigu Thanks for the feedback. I've updated the test and added info to the docs. There was no obvious section in the docs to place this in so I added a 'Utility' section. Let me know if I need to change it! :) |
This was discussed in #757. Couldn't see Tim's code in that issue so not sure how he originally implemented this, but hopefully I'm not too far of.
Ideas for performance improvements is more than welcome. It still takes a bit to insert 5k+ rows.
In short it will create a transaction and insert all the rows within that transaction.