Andrew Stephens
Andrew Stephens

Reputation: 10201

Rapid inserts using SQLite

I'm developing a data logging application that will be writing a row to a SQLite database roughly every 100ms. Without using transactions, inserting 100 rows at this interval takes 20 seconds - twice as long as it should.

Does SQLite provide anything that can help with what I'm trying to do, or is it a case of rolling my own solution (e.g. committing a transaction every N rows or N seconds)?

Upvotes: 3

Views: 87

Answers (2)

Colin
Colin

Reputation: 940

Have you considered 'Naive Inserts`?

http://blog.quibb.org/2010/08/fast-bulk-inserts-into-sqlite/

Upvotes: 1

CL.
CL.

Reputation: 180070

Commit a transaction only when no new data value is yet available; otherwise, write the new value(s) in the same transaction.

This automatically throttles transactions to the largest sustainable rate.

Upvotes: 1

Related Questions