Skip to content

fix: Disable shared cache on SQLITE, reduces SQLITE locking errors.#993

Open
omgbeez wants to merge 1 commit into
rogerfar:mainfrom
omgbeez:work/db-locking
Open

fix: Disable shared cache on SQLITE, reduces SQLITE locking errors.#993
omgbeez wants to merge 1 commit into
rogerfar:mainfrom
omgbeez:work/db-locking

Conversation

@omgbeez
Copy link
Copy Markdown
Contributor

@omgbeez omgbeez commented Jun 4, 2026

Per documentation by Sqlite and MS, using Cache=Shared is discouraged, especially in combination with WAL. WAL mode is supposed to be the better solution overall, and enabling shared cache changes table locking behaviour increasing errors seen from concurrent actions.

Microsoft.Data.Sqlite connection strings
Relevant sections:

Cache: Shared means connections share a cache and “can change the behavior of transaction and table locking.”
Example warning: Microsoft says mixing shared-cache mode and WAL is discouraged, and for optimal WAL performance you should remove Cache=Shared.

SQLite shared-cache mode
Relevant sections:

“Use of shared-cache is discouraged”
“Most use cases for shared-cache are better served by WAL mode”

Reading a bit on this, the only real clear use-case for Cache=Shared is when using in memory tables across multiple connections, as Cache=Private would result in multiple tables in that case (one per connection).

Per documentation by Sqlite and MS, using `Cache=Shared` is discouraged, especially in combination with WAL. WAL mode is supposed to be the better solution overall, and enabling shared cache changes table locking behaviour increasing errors seen from concurrent actions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant