mysql - What is the best way to insert million record in sequelize -
what best way insert million record using sequelize, using bulkcreate it's slow , didn't finish.
so think there's way it.
return dbmytable.bulkcreate(array, {transaction: t}).then(function (item) { return res.jsonp('done'); })
i ran same issue using postgresql , agree @e4c5 built-in database method best this. problem you're loading data memory until bulkcreate executes. if got million rows, you'll run out of memory before executes. still, if queue using async.cargo, you'll still waiting db while data asyncrhonously consumes memory.
my solution ditch sequelize loading of data (at least until implement streaming or (see github issue #2454)). ended creating db-streamer, has pg support now. you'll want @ streamsql mysql.
Comments
Post a Comment