mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
Differences between Database Queues and Pools
This commit is contained in:
1 parent
7e8f2e2fbc
commit
d0146762bc
1 file changed
+2
-2
@@ -6266,13 +6266,13 @@ Those guarantees hold as long as you follow three rules:
|
||||
|
||||
Despite the common [guarantees and rules](#guarantees-and-rules) shared by [database queues](#database-queues) and [pools](#database-pools), those two database accessors don't have the same behavior.
|
||||
|
||||
Database queues serializes all database accesses, reads, and writes. There is never more than one thread that uses the database. In the image on the left below, we see how three threads can see the database:
|
||||
**Database queues** serialize all database accesses, reads, and writes. There is never more than one thread that uses the database. In the image on the left below, we see how three threads can see the database:
|
||||
|
||||
| Database Queue | Database Pool |
|
||||
| -------------- | ------------- |
|
||||
|  |  |
|
||||
|
||||
Database pools serializes all writes, but allows concurrent reads and writes. On top of that, reads are guaranteed an immutable view of the database. This gives a very different picture (on the right).
|
||||
**Database pools** serialize all writes, but allow concurrent reads and writes. On top of that, reads are guaranteed an immutable view of the database. This gives a very different picture (on the right).
|
||||
|
||||
See, at the bottom of the image, how two threads can see different database states at the same time.
|
||||
|
||||
|
||||
Reference in new issue
Block a user