[ZODB-Dev] ZODB idioms

Casey Duncan casey@zope.com
24 Jun 2002 11:28:26 -0400


On Mon, 2002-06-24 at 11:16, Toby Dickenson wrote:
> On Monday 24 Jun 2002 3:33 pm, Jeremy Hylton wrote:
[snip]
> > BTrees do not rebalance themselves.  I suspect that the use of random
> > ids in Zope is to avoid balancing problems by random insertions.  In
> > the case of sequential ids, each BTree bucket will be half full.  When
> > the bucket reaches its limit, it will be split into two buckets of
> > equal size (call them left and right).  Since the ids are sequential
> > the left bucket will never grow and all the new ids will be put in the
> > right bucket.
> 
> Eeeeek. There are a number of cases in Zope where I suspect this could be 
> catastrophic.
> 
> For example, ZCatalog creates a standard index for every object's last 
> modified time. The reverse index OIBTree is keyed on last modified time, and 
> is therefore likely to be grossly unbalanced.

Hmmm, I thought the B stood for "Balanced". Isn't that false
advertising? ;^) Unless of course it stands for binary...

This could make FieldIndexes of sequencial values rather unfortunate....

-Casey