greenrobot / greenDAO

greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.
http://greenrobot.org/greendao/
12.63k stars 2.89k forks source link

Add non-exclusive transactions #159

Open slavat opened 9 years ago

slavat commented 9 years ago

I have quite long inserts inside transactions in my project (several seconds). SQLITE is blocked on read and write by default during transactions. So read requests are waiting for the DB while insert transactions are in progress.

Android has support for write-ahead logging and non-exclusive transactions since API 11. If you call SQLiteDatabase.enableWriteAheadLogging() and begin transactions with beginTransactionNonExclusive() you can execute reads while transactions are in progress.

It will be great to have support for non-exclusive transactions in AbstractDao and anywhere else if necessary.

jdmunro commented 9 years ago

I have a similar situation where I have some slowish insert transactions that happen on a background thread. I'm reading these entities into a lazy list and displaying them in a list view, but the list view is occasionally blocked as an insert transaction takes place in the background, momentarily locking read access in the UI.

equreshi commented 7 years ago

Is there an ETA on this feature?

nickylin commented 7 years ago

is anyone try to use this feature for non-exclusive transactions? will this work?

carlpoole commented 6 years ago

Non-exclusive transactions would be a big help here too. Thank you