orlandov / node-sqlite

Asynchronous, non-blocking SQLite3 bindings for Node.js
262 stars 29 forks source link

Transactions? #1

Open astro opened 14 years ago

astro commented 14 years ago

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()?

orlandov commented 14 years ago

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.

Pita commented 13 years ago

I wanna do the same as @astro

Pita commented 13 years ago

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