bsddb3 vs zodb

Ralph Corderoy ralph at inputplus.demon.co.uk
Thu Sep 27 16:29:52 EDT 2001


Hi Skip,

> > True.  It's worth noting however that BerkeleyDB 3.3 adds support
> > for automated "secondary indexing" which really gives it a
> > significant chunk of capabilities that people often end up using
> > for full fledged relational databases for. 
>
> Can you explain what "secondary indexing" is?  I was never aware I
> needed it and am using relational databases because of it. ;-)

Have any of your tables got an index built on any column, or
combination of columns, other than the primary key?

For example, given (user_id, surname) then user_id would be the unique
primary key.  No two people would have the same user_id.  Your
relational database can give you a list of all people called `Smith'
but it would have to do this by sequentially stepping through each row
examining the row's surname.

If `surname' is made a secondary key then the database will also
maintain an index of the surnames and you'd have told it they aren't
unique;  there may be more than one Smith in the world.  Then when you
ask for all the Smiths it can use the index for the surname secondary
key to give you the answer much more efficiently.

    user_id surname
    5       Smith
    1       Able
    3       Baker
    2       Charlie
    4       Smith

    surname user_ids
    Smith   5, 4
    Able    1
    Charlie 2
    Baker   3


Ralph.




More information about the Python-list mailing list