read_uncommitted
Allow this connection to read rows other connections have changed but not committed.
- Par défaut
0 (off)- Range
- 0, 1
- Restart needed
- Non
- Default checked on
- SQLite 3.5x
Ce que cela fait
SQLite's default isolation is SERIALIZABLE. READ UNCOMMITTED only takes effect between connections that share a page and schema cache; cache sharing is off by default and enabled per process with sqlite3_enable_shared_cache(). Without shared cache this pragma changes nothing.
Valeur par défaut
0 (off). Off (a stock SQLite 3.5x build); the shared-cache mode it depends on is off by default too.
Check the current value
PRAGMA read_uncommitted; SELECT * FROM pragma_read_uncommitted; -- table-valued form, usable in queries
Change it
PRAGMA read_uncommitted = ON; -- this connection only
No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When to change it
In shared-cache applications that deliberately trade isolation for fewer lock conflicts between threads of one process. Outside shared-cache mode, leave it alone.
What can go wrong
With it on, a connection can read rows the writer rolls back moments later, so totals and joins can mix committed and abandoned data. Outside shared-cache mode the pragma silently does nothing, which misleads people who set it expecting looser isolation.
Questions about read_uncommitted
What is the default value of read_uncommitted in SQLite?
0 (off). Off (a stock SQLite 3.5x build); the shared-cache mode it depends on is off by default too.
Does changing read_uncommitted require a restart?
No. No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When should I change read_uncommitted?
In shared-cache applications that deliberately trade isolation for fewer lock conflicts between threads of one process. Outside shared-cache mode, leave it alone.
Back to all SQLite settings, or check the SQLite manual for every option.
Check read_uncommitted on your own server
SQLly runs the query above against SQLite and the other engines in this reference, from one desktop app on macOS, Windows and Linux.
Texte et données de cette page : CC BY 4.0, en citant SQLly (sqlly.app). Code et extraits SQL : MIT. Détails de la licence