sqliteではTransactionを明示的に書いて高速Insert
Node.js sqlite3: very slow bulk insertsnelsonslog.wordpress.com
found the problem, I wasn’t using transactions right. See bottom. Simple solution for faster bulk inserts in sqlite3: do them with a transaction.
とあって、
db.run("begin transaction"); ..... db.run("commit");
と書くとbulk insertが劇的に早くなる。実際に試して200万件のInsertが8倍位早くなった。