Name

omit_readlock — Disable read locks on read-only files

Common Usage

PRAGMA omit_readlock;
PRAGMA omit_readlock = switch;

Description

The omit_readlock pragma disables read locks when accessing a read-only file. Disabling read locks will provide better performance, but can only be done safely when all processes access the file as read-only.

This flag is particularly useful when accessing database files on read-only media, such as an optical disc. It can also be safely used for “reference” database files, such as dictionary files, that are distributed but never modified by the client software.

Disabling read locks for all read-only files is not recommended. If one process opens a database read-only and another process opens the same database read/write, the locking system is still required for transactions to work properly. This pragma should only be considered in situations where every possible process that might access a database file is doing so in a read-only fashion.

This is an undocumented pragma.

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.