Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

Would ATTACH'ed Sqlite databases support parallel writes from multiple threads?

I'm trying to understand if using the ATTACH DATABASE feature of Sqlite allows a single process use 2 threads to write to two databases in parallel.

There are a number of questions and answers clarifying how using WAL allows Sqlite to support multiple writer threads to a database, but I could not find a document or question that clarifies how writes from different threads to multiple databases work.

The documentation of ATTACH DATABASE says:

Transactions involving multiple attached databases are atomic, assuming that the main database is not ":memory:" and the journal_mode is not WAL. If the main database is ":memory:" or if the journal_mode is WAL, then transactions continue to be atomic within each individual database file.

This makes me think that N databases would have N dedicated WALs and a write to a database would be independent of other databases.

I'm hoping I can use multiple files for multiple databases, where db files reside on different disks.

question from:https://stackoverflow.com/questions/65645065/would-attached-sqlite-databases-support-parallel-writes-from-multiple-threads

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...