Support for concurrent readers and serialized writers?

126 views
Skip to first unread message

Simon Harris

unread,
Apr 25, 2013, 6:01:21 AM4/25/13
to fm...@googlegroups.com
AFAIK, SQLIte supports multiple concurrent readers, serialized writers just fine. Is there any reason—other than time and effort—not to add support for this to FMDB?

I'm thinking something like inReadTransaction and inReadWriteTransaction, where the former can run concurrently but only one of the latter can ever run at a time.

I have no idea how hard this would be but I might try unless there's a critical reason not to.

Thoughts?

Simon



August Mueller

unread,
Apr 25, 2013, 12:39:15 PM4/25/13
to fm...@googlegroups.com
On Apr 25, 2013, at 3:01 AM, Simon Harris <haruki...@mac.com> wrote:

AFAIK, SQLIte supports multiple concurrent readers, serialized writers just fine. Is there any reason—other than time and effort—not to add support for this to FMDB?

I'm thinking something like inReadTransaction and inReadWriteTransaction, where the former can run concurrently but only one of the latter can ever run at a time.

There's FMDatabasePool which might be what you're after.  It'll open up another connection and read on multiple threads at the same time.  Just don't try using it for updates or inserts *or you're going to have a bad time*.

-gus

Simon Harris

unread,
Apr 25, 2013, 5:00:47 PM4/25/13
to fm...@googlegroups.com


On Friday, April 26, 2013 2:39:15 AM UTC+10, Gus Mueller wrote:

There's FMDatabasePool which might be what you're after.  It'll open up another connection and read on multiple threads at the same time.  Just don't try using it for updates or inserts *or you're going to have a bad time*.

Looks perfect! Pretty much exactly what I had in mind ha! Except I was thinking of structurally separating read from read/write transactions. I might just add a category (or *something*) to do that using a dispatch_sync or something.

Thanks,
Simon

Scott Corscadden

unread,
Jan 6, 2015, 4:37:22 PM1/6/15
to fm...@googlegroups.com
Hey Simon. There's another thread where Brian Rodgers was asking much the same thing. Did you end up with anything that structurally separated writes-on-a-queue from reads-on-a-pool? 

Simon Harris

unread,
Jan 7, 2015, 3:24:11 AM1/7/15
to fm...@googlegroups.com
Hi Scott,

Hadn't done anything further but I'm about to resurrect a dormant project that will probably get me looking into it again.
Reply all
Reply to author
Forward
0 new messages