Re: Teach SELECT DISTINCT first!
From: Paul <paul_at_test.com>
Date: Tue, 27 Apr 2004 22:15:17 +0100
Message-ID: <j7Ajc.36911$Y%6.5021809_at_wards.force9.net>
>
> CAS usually assumed to have this kind of knowledge, so why (in principle)
> relational engine couldn't have it? The technical difference might be that
> everything in CAS is an expression, while in SQL we allow function
> programmed in 3GL language. In foreseeable future no relational optimizer is
> expected to look inside procedural code, of course. (Note an interesting
> analogy: it is easy to reason about a function defined decalratively as an
> expression, and its very hard to reason about fuction defined procedurally.)
Date: Tue, 27 Apr 2004 22:15:17 +0100
Message-ID: <j7Ajc.36911$Y%6.5021809_at_wards.force9.net>
>>There's no way in general an optimizer can tell whether or not there are >>duplicates without doing the calculation. Even if f were a relatively >>simple function it would be too much to expect that a relational engine >>should have knowledge of maths built-in.
>
> CAS usually assumed to have this kind of knowledge, so why (in principle)
> relational engine couldn't have it? The technical difference might be that
> everything in CAS is an expression, while in SQL we allow function
> programmed in 3GL language. In foreseeable future no relational optimizer is
> expected to look inside procedural code, of course. (Note an interesting
> analogy: it is easy to reason about a function defined decalratively as an
> expression, and its very hard to reason about fuction defined procedurally.)
OK here's a pathological example:
Define a function f on the integers by:
f(i) = i (if Fermat's Last Theorem is true
- 0 (if Fermat's Last Theorem is false
Paul. Received on Tue Apr 27 2004 - 23:15:17 CEST