node-sqlite icon indicating copy to clipboard operation
node-sqlite copied to clipboard

Transactions?

Open astro opened this issue 15 years ago • 3 comments

I'm experiencing very low INSERT performance. http://www.sqlite.org/speed.html advises to use transactions.

db.query("BEGIN; INSERT ...; INSERT ...; INSERT ...; COMMIT;", [], function() { }); doesn't work. Passing the SQL queries as individual serial queries doesn't work either. Any alternative to query()?

astro avatar Jun 30 '10 23:06 astro

Yeah there's a lot that needs to be optimized there... I'd recommend using the low level node bindings. Prepare your own statements, bind your placeholder variables and then step through them as necessary. Have a look in sqlite.js for how to do this, it's not too difficult.

orlandov avatar Jul 01 '10 19:07 orlandov

I wanna do the same as @astro

Pita avatar May 30 '11 17:05 Pita

I tried to insert multiple rows with one insert. That creates issue #32 :/

Pita avatar May 30 '11 22:05 Pita