Re: Possible inaccuracy in "Isolation In SQLite" paper

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Possible inaccuracy in "Isolation In SQLite" paper

Clemens Ladisch
Rowan Worth wrote:
> On 18 July 2017 at 21:43, David Raymond <[hidden email]> wrote:
>> You can run "begin deferred transaction" then walk away for 3 months
>> without upsetting anything. If you need the precise timing then why not
>> just use "begin immediate"?
>
> IMMEDIATE would take a RESERVED lock which is clearly not desired in this
> case -- the reader only wants a SHARED lock so as to minimise contention
> with the writer.

Then to take a SHARED lock, you have to actually read something from the
database, e.g.:

  BEGIN DEFERRED TRANSACTION;
  PRAGMA user_version;


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Possible inaccuracy in "Isolation In SQLite" paper

Gwendal Roué-2

> Le 20 juil. 2017 à 08:45, Clemens Ladisch <[hidden email]> a écrit :
>
> Rowan Worth wrote:
>> On 18 July 2017 at 21:43, David Raymond <[hidden email]> wrote:
>>> You can run "begin deferred transaction" then walk away for 3 months
>>> without upsetting anything. If you need the precise timing then why not
>>> just use "begin immediate"?
>>
>> IMMEDIATE would take a RESERVED lock which is clearly not desired in this
>> case -- the reader only wants a SHARED lock so as to minimise contention
>> with the writer.
>
> Then to take a SHARED lock, you have to actually read something from the
> database, e.g.:
>
>  BEGIN DEFERRED TRANSACTION;
>  PRAGMA user_version;

Yes, that's exactly that.

See https://github.com/groue/GRDB.swift/blob/2526e0a2f7097acbb71e41fb55baeda9d98c441d/GRDB/Core/DatabasePool.swift#L516-L540 for an implementation

For a description of the benefits that users can have from such precision snapshotting, read: https://github.com/groue/GRDB.swift/blob/master/README.md#advanced-databasepool

And on such robust ground, you can build very high-level constructs like https://github.com/RxSwiftCommunity/RxGRDB

Gwendal Roué

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Loading...