SQL user function returning list for IN clause

pjcoup pjcoup at gmail.com
Sat Oct 17 04:40:55 CEST 2009

On Oct 16, 9:50 am, Felix <schle... at cshl.edu> wrote:
> I could create a new table matching each row in b to all values of
> b.bar and use that to join but that would be inefficient and very
> redundant.

Is foobar(b.bar) essentially static? (I'm guessing so if you
considered this as an option).
If so, then this actually sounds like the best option to me.
Indexing on the foobar return values, this new table and joining
as described has got to be faster than the other alternatives
(even the foobar(b.bar,k) options).
Without this new table, it seems you have to calculate foobar(b.bar)
for every row of b (even if it is SQLite doing it, and not you
directly), unless I'm missing something.  I'm assuming that the
overhead to store these function values won't kill you.
Good luck!


More information about the Python-list mailing list