I tested sqlite3, and mongodb with same task. loop task insert 10M times. mongodb done in 13seconds, but sqlite3 even run 30 minutes still writing, is there something wrong with my sqlite config? sqlite write temporary journal like 1-9kb repetitive. i know the ways to concanate query to insert all in 1 query. but, what i want to test is speed of bunch of query. ex, 10M times.
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('database.db', error => {
if (error) console.log(error)
if (error == null) console.log('Succefully connected');
});
// CREATE TABLE IF NOT EXISTS user (id BIGINT, username TEXT, password TEXT)
db.serialize(() => {
const stmt = db.prepare('INSERT INTO user (id, username, password) VALUES ($id, $username, $password)');
for (let i=0; i < 10000000; i++) {
stmt.run({
$id: i,
$username: 'admin',
$password: 'passadmin'
})
};
stmt.finalize()
});
db.close();