SQLite Forum

Multithread processing, storing in memory and writing to database
Login
A fourth approach,

Have each thread write to its own database, but instead of an in-memory database, just use SQLite in WAL mode and set synchronous to zero. The main thread could then perform checkpointing on these databases synchronously without blocking the writer threads.

And no, you don't need to aggregate the data later in a single database, you can attach all the databases from a single connection and query it as you like.