[Zope3-Users] ZODB and unique values

Jim Fulton jim at zope.com
Tue Aug 4 06:28:47 EDT 2009

On Mon, Aug 3, 2009 at 9:09 PM, Gary Poster<gary.poster at gmail.com> wrote:
> On Aug 3, 2009, at 3:00 PM, Gustavo Rahal wrote:
> Practically, using the BTrees that the ZODB provides will typically
> have the behavior you want for the first and third gotcha.  For the
> second gotcha, we typically give each connection to the ZODB its own
> random starting point stored on a volatile (disposable) attribute for
> the index, and each connection increments that point.  Look at the
> code in zope.intid, for instance: _generateId in http://svn.zope.org/zope.intid/trunk/src/zope/intid/__init__.py?rev=100049&view=auto


Note that a simpler variation on this is to assign the values
randomly.  Assigning them sequentially from a random starting point is
an optimization to reduce the number of BTree nodes read and updated
by a particular client.


Jim Fulton

More information about the Zope3-users mailing list