What is the Default Threading mode of SQLite in Android? What is the Default Threading mode of SQLite in Android? sqlite sqlite

What is the Default Threading mode of SQLite in Android?


Default Mode - Serialized

By default SqliteDatabase is Thread safe, you can check it on the Android Docs,

setLockingEnabled(boolean lockingEnabled)

From the Docs -

Control whether or not the SQLiteDatabase is made thread-safe by using locks around critical sections. This is pretty expensive, so if you know that your DB will only be used by a single thread then you should set this to false. The default is true.


Threading mode of sqlite can be configured in compile-time, start-time and runtime.

Run-time overrides start-time and start-time overrides compile-time. Except, single-thread mode cannot be overridden once selected. See sqlite threadsafe

Android use Serialized in compile time. See sqlite Android.bp.

However, starts from 4.2.2, android select Multi-thread in start-time. See android_database_SQLiteGlobal.cpp