 # Re: Distributivity in Tropashko's Lattice Algebra

From: vc <boston103_at_hotmail.com>
Date: 16 Aug 2005 11:22:54 -0700

Marshall Spight wrote:
> vc wrote:
> > 2. If you'd like to get rid of the select clause and use join, than we
> > are back to the problem of infinite relations since our function is
> > materialized in the hypothetical database as a relation (unless you can
> > suggest another way of implementing the join).
>
> If the join's operands have enough attributes in common, then the
> function can be applied fully at join time.

But what *is* a function in your algebra ? The operation like 'join' or wahtever can be applied only to relations so either you model the function as a relation or your structure is not an algebra Could you clarify ?

> If it doesn't, then
> we can consider it a partial application. (There may be some
> pathological edge cases; I have not explored this fully.)
>
>
> > 3. You may be interested to know that Oracle (as well as MS SQL
> > Server) has so-called table functions. The table function behaves as
> > if it were a real table. One can say for example "select a,b,c from t1
> > join table(f)". If the table(f) cardinality is infinite, the query of
> > course will never complete. One can parameterize the "f" function in
> > order to make its cardinality finite, but parameterizing won't work in
> > general, obviously.
>
> Interesting. Did I read that correctly that "table()" takes a function
> and converts it to a table?

A table function is defined(in PL/SQL) slightly differently then a 'normal' function, but other tha that, yes.

>In that case, given that t1 is finite,
> couldn't we reduce/optimize the execution so that this did complete?

Assuming, your function represents an infinite table of even numbers. You want to join a real table with the function. How would the function 'know' where to stop ? How would the db optimize gaps ? Etc. All in all, it appears that infinite relations are more pain than gain (sort of obvious).

> Also, if f is not infinite, how is that expressed in the definition of
> f? (Or am I reading this incorrectly?)

You can supply a parameter, like, select * from table(f_list_of_even_numbers(max_number));

>
>
> Marshall
Received on Tue Aug 16 2005 - 20:22:54 CEST

Original text of this message