[ZODB-Dev] Finding objects by attribute value?

Leif K-Brooks eurleif at ecritters.biz
Wed Jan 5 02:56:50 EST 2005


Tim Peters wrote:

>[Leif K-Brooks]
>  
>
>>If my dbroot['foo'] contains an OOBTree where the values are object which
>>have an attribute called "attr", what's the best way to get a list of the
>>objects whose "attr" attribute is equal to a certain value, along the
>>lines of SQL "SELECT * FROM foo WHERE attr=123"?
>>    
>>
>
>As Christian Reis implied, unless you also build your own indexing objects
>to speed such searches, brute force is the only approach.
>
The speed of a brute-force search isn't terrible when I'm using 
FileStorage; actually, it seems a bit faster than an equivalent MySQL 
search. The big performance problem comes when using ZEO, since each and 
every object has to be transported across the network. What would be 
really neat is if I could somehow ask the ZEO server to perform a 
brute-force search of the OOBTree containing my objects and only send me 
the relevant objects. Is there any way to do that?


More information about the ZODB-Dev mailing list