@@ -142,6 +142,32 @@ queries.
142142 The operation is idempotent and safe to call across multiple sessions,
143143 allowing concurrent reads during writes.
144144
145+ ** Synchronous Mode: NORMAL vs FULL**
146+
147+ When WAL mode is enabled, this library sets ` PRAGMA synchronous = NORMAL `
148+ instead of ` FULL ` for the following reasons:
149+
150+ * ** Performance** : ` NORMAL ` provides significantly better write performance
151+ (up to 2-3x faster) by reducing the number of fsync operations. With ` FULL ` ,
152+ SQLite syncs after every checkpoint; with ` NORMAL ` , it syncs only the WAL file.
153+
154+ * ** Safety in WAL mode** : ` NORMAL ` is safe in WAL mode because:
155+ * WAL transactions are atomic and durable at the WAL file level
156+ * The database file itself can be checkpointed asynchronously
157+ * A crash may corrupt the database file, but the WAL file remains intact
158+ and will be used to recover on next open
159+ * This is different from rollback journal mode where ` NORMAL ` could cause
160+ corruption
161+
162+ * ** Mobile/Desktop Context** : For typical desktop and mobile applications,
163+ ` NORMAL ` provides the best balance of performance and safety. ` FULL ` is
164+ primarily needed for scenarios with unreliable storage hardware or when
165+ power loss can occur mid-fsync operation.
166+
167+ See [ SQLite WAL Performance Considerations] [ wal-perf ] for more details.
168+
169+ [ wal-perf ] : https://www.sqlite.org/wal.html#performance_considerations
170+
1451714 . ** Exclusive Writes** : The write pool has ` max_connections=1 ` , ensuring
146172 only one writer can exist at a time. Other callers to
147173 ` acquire_writer() ` will block (asynchronously) until the current writer
0 commit comments