On Tue, May 03, 2005 at 02:44:58PM +0200, Thomas Guettler wrote: > It would be better if the index would do the search for customer_id > first, and then filter the result by deleting entries which are not in > the given time period. > > Has anyone done such a "Query Optimization"? (Zope, Zope3, IndexCatalog, ...)
I have done it, but the way we do it in IC is synthesize an index on-the-fly and then do the range query through it. The code is in Indexes.py:build_temp_index; it's a nasty little hack. > Since btrees and btree ranges don't know their size, you need to do something > like this: > - do range searches at the end > - if index "foo" is used, use it first, ... Hmmm. Can you elaborate on this? I don't quite grasp what you mean. I think the only way to implement this correctly is using a different data structure -- one that allows you to slice and dice your data in different axis. I may be short-sighted, though. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331 _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev