Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Cursor iterating only keys?



> One thing, however -- if you are going to modify the key/data
> pairs, and you want to minimize the duration and variety of
> locks you hold within that transaction, a read-only iteration
> operation outside of a transaction, followed by a transaction
> in which you retrieve and modify the key/data pairs in which
> you are interested, should result in fewer locks held for a
> shorter period of time, and perhaps in higher overall concurrency.
>

 Keith,  this is how I often do it and it works great for me.  I set my
data DBT for a partial read of lenth zero, and just grab the keys with a
transactionless cursor.  From my in-memory list of keys, I then
permform a transaction-protected DB->get with the RMW flag,
modify the data, and DB->put under the same transaction.

Sometimes, I have to retry the DB->put due to deadlock, but rarely
do I have to retry more than once, and it still a good trade-off.

--Sarge





<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.