diff --git a/README.md b/README.md index 64ff166ee..468d70d17 100644 --- a/README.md +++ b/README.md @@ -400,10 +400,12 @@ let poiCount = try dbPool.read { db in Database pools allow several threads to access the database at the same time: - When you don't need to modify the database, prefer the `read` method, because several threads can perform reads in parallel. + + The total number of concurrent reads is limited. When the maximum number has been reached, a read waits for another read to complete. That maximum number can be configured (see below). -- The total number of concurrent reads is limited. When the maximum number has been reached, a read waits for another read to complete. That maximum number can be configured (see below). - -- Conversely, writes are serialized. They still can happen in parallel with reads, but GRDB makes sure that those parallel writes are not visible inside a `read` closure. +- Conversely, writes are serialized. They don't block reads, but GRDB makes sure that `read` closures are guaranteed an immutable view of the last committed state of the database. + + :point_up: When you need `read` closures to be guaranteed an immutable view of the last executed writing block as a whole, use `writeInTransaction` instead of `write`. **A database pool needs your application to follow rules in order to deliver its safety guarantees.** Please refer to the [Concurrency](#concurrency) chapter.