> > Rewriting the query to say > > select * from table a, table b where foobar_predicate(a.foo, b.bar) > > would work (foobar_predicate checks if a.foo is in foobar(b.bar). But > > it does not allow to use an index on a.foo
> Define a function foobar_contains() as follows: > > def foobar_contains(foo, bar): > return foo in foobar(bar) > > and change the query to > > select * from table a, table b where foobar_contains(a.foo, b.bar) I thought about that (see above), but it would not use an index on a.foo which a regular a.foo IN (x,y,z) does. Felix -- http://mail.python.org/mailman/listinfo/python-list