Node.js sqlite export database

Viewed 822

I have a problem with node.js and node sqlite npm package. I am making a server-client app and i need to interrogate a sqlite db a lot, and i observed when i do more than 4 queries at a request it is beginning to block the event loop when reading from file.

var data_db = new sqlite3.Database('data.db');

Sometimes i get even a 18 seconds event block. This happens when i do many requests on server, otherwise i get 40ms 50ms event block as well, which is not good.

I observed if o do it in the memory, everything goes lightning fast.

var data_db = new sqlite3.Database(':memory:');

So my idea is to make everything in memory and at the beginning to import from data.db then at every 60 seconds to export it to data.db

The thing is that i don't know how to export from node.js, how do i do that? Ideas?

0 Answers
Related