Re: Just for the record
Date: 1 Jul 2006 10:35:08 -0700
David Cressey wrote:
> Many of the disastrous database designs that I've seen in the SQL world stem
> from a premature preoccupation with efficiency, at the expense of
> sufficient attention to either relevance or correctness.
> This is particularly true when it comes to database design, but it's also
> truw about query design.
> A number of times, people have come to me with a SELECT that they want
> speeded up. While playing with the query, I happen to notice that SELECT
> can give wrong answers, where SELECT DISTINCT will give right answers.
> When I point this out to my consultee, he says, "yes but that's even
> slower!" To me, this is putting the cart before the horse.
Not to mention the fact that I have seen cases where SELECT DISTINCT is *faster* than a plain select.
> To me, tuning a query is selecting a fast query among all the correct
> queries. If a query is known to be incorrect, that disqualifies it.
Yes, the ol' "how fast do you want the wrong answer" bit. :-)
Now, it is perfectly reasonable, in cases where exact accuracy is not necessary, to use an approximation function instead, but *one has to be mindful* that that is what one is doing.
Because at that point, one is making an explicit trade of speed for accuracy. And if one isn't paying attention to the fact that one is doing that, one won't make the tradeoff very well.
Marshall Received on Sat Jul 01 2006 - 19:35:08 CEST