Re: Grammatical Inconsistencies
Date: Sat, 24 Apr 2004 22:17:27 -0400
Message-ID: <a4udnUP0rfgeghbdRVn-jw_at_comcast.com>
I am sorry, but I am right on this one.
SELECT DISTINCT does produce a project.
And it is relevant. Let me explain why. Earlier, Dawn said this:
> If we take your example above, when I have taught SQL (scary thought, eh?)
I
> have taught how to get your result set by applying JOIN, RESTRICT, and
> PROJECT functions for a simple select statement on two tables like this:
>
> PROJECT(RESTRICT(JOIN(G,F)))
>
> (Using f(x) notation for functions)
Now this is strictly, mathematically correct. As soon as Timothy finishes
clarifying the distinction between
CROSS PRODUCT and JOIN, the next issue that will come up is how one does a
project in SQL.
And, at that point, the difference between SELECT DISTINCT and SELECT ALL
becomes crucial
to the discussion.
Actually,
> PROJECT(RESTRICT(JOIN(G,F)))
Is a good way of beginning to use relational transforms for their full
power, PROVIDED YOU TRUST THE OPTIMIZER!!!! Because if it actually did
things in this order, the query could run thousands of times slower than it
really will run. The optimizer knows how to do a lot of good stuff, and if
you don't trust it, you waste time on thinking about how to do it rather
than on what you want to do.
Most of the idiot code I've seen in SQL, whether its the original DDL or the DML was written by people who think they have to beat the optimizer at its own game! This situation isn't helped by the fact that Oracle's RBO was really quite lame, compared to a really good CBO. So people learned all kind to tricks and "hints" instead of learning simple, sound design! Received on Sun Apr 25 2004 - 04:17:27 CEST