[Zope] Questions on ZODB BTrees versus bsddb BTrees

Chris Withers chris at simplistix.co.uk
Thu May 4 02:30:03 EDT 2006


Terry Jones wrote:
> I've just read the ZODB/ZEO Programming Guide (Release 3.6.0,
> A.M. Kuchling, January 5, 2006) and I'd like to ask a few questions.
> 
> Are the following all correct?

You may have more joy with these questions on the zodb-dev at zope.org 
mailing list...

>  - The BTrees supported by ZODB have nothing to do with Berkeley DB Btrees
>    (apart from the fact that they're both implementations of BTrees).

Correct. And I think the ZODB ones are a variant of BTree...

>  - ZODB BTrees do not allow duplicate keys (a la bsddb).

Correct.

>  - ZODB BTrees do not allow you to set up secondary keys (a la bsddb).

Dunno what that means. I think you're just use two BTrees for this...

>  - Is the byValue() ZODB BTree method officially deprecated? Scheduled for
>    deprecation / removal?

Never used it, no idea...

> Assuming the first three above are correct, and that I would like both
> duplicate keys 

What do you mean by duplicate keys? This sounds like a fairly screwy 
concept for a mapping... Do you mean you want to map one key to a set of 
values or that you want to map more than one key to the same value?

> and secondary keys 

Again, you need to explain what you mean by secondary keys...

>  1. Use both ZODB and bsddb in the same application, dealing with things
>     like locking and transactions across both object types in a somewhat
>     manual way.

Oooo.. feel the pain...

>     This would have the additional major downside of making it harder to
>     use ZEO for storage, right? (Yes, I could pickle the entire bsddb
>     databases and hand them to ZEO, but that's not really what I had in
>     mind.)

That would be insane ;-)

>  2. Try to add support for bsddb BTrees (with duplicate keys) to ZODB.

Doubt you'd want to do that ;-)

>  3. Redesign what I'm doing so as to only need ZODB BTrees. This is quite
>     far from optimal (in terms of space and time), but might be the
>     quickest to implement.

I think there are things that you can do with BTrees and their Set 
objects that will solve any problems you have. You need to explain what 
it is you're trying to do and we can help you...

> If someone with more knowledge of ZODB and the BTrees therein and bsddb
> feels like confirming, correcting, or commenting on the above summary, and
> options, that would be great.

Take a look at the code in ZCatalog and PluginIndexes. I think you'll 
find everything you're looking for...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope mailing list