Am Donnerstag, 5. Mai 2005 19:18 schrieb Christian Robottom Reis:
> 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.
If you want the intersection (AND) of some sets, you can increase the speed
if you take the the smallest set and check for each entry if it is a member of
the other sets. If you do take the large set first, you need to do more
checks for membership.
The application developer might know that a search in index "foo" results in
small results. That's what I meant with "if index 'foo' is used, use it
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org