// sqlite · sql behavior

read_uncommitted

Allow this connection to read rows other connections have changed but not committed.

기본값
0 (off)
Range
0, 1
Restart needed
아니요
Default checked on
SQLite 3.5x

기능

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.

기본값

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.

// one client for every engine

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.

이 페이지의 텍스트와 데이터: CC BY 4.0, 출처: SQLly (sqlly.app). 코드와 SQL 스니펫: MIT. 라이선스 세부 정보