Skip to content Skip to sidebar Skip to footer

Best Practices For Using Sqlite3 + Node.js

I've got a modest Node.js script that pulls down data from Wikipedia via the API and stores it in a SQLite database. I'm using this node-sqlite3 module. In some cases, I'm pulling

Solution 1:

When you are doing several insertions into a SQLite database, you need to wrap the collection of insertions into a transaction. Otherwise, SQLite will wait for the disk platters to spin completely around for each insert, while it does a read-after-write verify for each record that you insert.

At 7200 RPM, it takes about 1/60th of a second for the disk platter to spin around again, which is an eternity in computer time.

Post a Comment for "Best Practices For Using Sqlite3 + Node.js"