[ZODB-Dev] ZODB queries (was ZODB and ORBit-Python problems)

Christian Robottom Reis kiko@async.com.br
Tue, 22 May 2001 14:37:01 -0300 (BRT)


On Tue, 22 May 2001, Greg Ward wrote:

> It sounds like you don't want a query language per se, but rather an
> efficient query mechanism.  So would I!  I don't much mind writing
> queries in Python -- simple queries are probably a bit wordier than they
> would be with (say) OQL, but at least I don't have to learn another
> language.  More importantly, I don't have to embed that new language in

Greg, 100% correct. I had ignored this point, but it's important -- the QL
isn't the important part - a mechanism for querying, however, _is_.

SQL/OQL is nice if you want to provide for user-defined queries, but who
wants users, anyway? :-)

> However, I *would* like to see some (documented and comprehensible)
> infrastructure for indexing a ZODB.  (I've attempted to read the code
> for Catalog and related classes, but came away understanding less than I
> went in with.)  As it stands, if I want to query every Thing object in
> our database, I have to loop over our collection of all Things, load
> each into memory, and query it.  Our database isn't very big, so this

I believe both SearchIndex and Catalog (higher-level? who knows?) exist to
solve this. As far as them being undocumented, I've offered to write-up as
soon as somebody shows me some simple, short, working code that uses them.

I don't know, however, if a full solution is orthogonal to pickling, and
nobody has answered if this point is moot. AFAICS if you use unstructured
storage, your indexes will replicate attribute data that's in the DB, and
you'll have the problems of syncing that during updates and deletes. Apart
from that, you need a whole lot of indexes -- one for each query method.
Am I off-track here?

> isn't a big deal (yet).  I can see that it would be a showstopper for
> someone with (say) hundreds of thousands of Thing objects in their
> database.

Which is where I fit in, unfortunately. :-)

Take care,
--
/\/\ Christian Reis, Senior Engineer, Async Open Source, Brazil
~\/~ http://async.com.br/~kiko/ | [+55 16] 274 4311