Re: Parts explosion with repeated subtrees

From: Mikito Harakiri <mikharakiri_at_ywho.com>
Date: Wed, 18 Dec 2002 16:14:38 -0800
Message-ID: <bg8M9.14$Md.114_at_news.oracle.com>


Dumb database schema -- agreed, but dumb queries, is really such a thing?

Arguably, #1 on list might be forgetting join condition, so that Cartesian Product is returned. But can we really tell by looking into the query only, without knowing the data? Hardly. For example the intention might be two queies combined into a single one.

#2 is extracting data from a complex join view, when a single table query is needed. This is solely an optimization issue -- smart optimizer would reduce the execution path to scanning the relevant table only.

#3: "1=1" predicate in the query. Again, this might serve some purpose: for example, application programmer have trouble counting poles and spaces between poles, so that when generating SQL he simply concateneates "and predicate" conjuncts.

In short, SQL is a high abstraction language. It is difficult to do stupid things in the high level language. Counter examples please.

"David Cressey" <david_at_dcressey.com> wrote in message news:pG7M9.348$0I3.40423_at_petpeeve.ziplink.net...
> > Actually, I was thinking about doing book six on either data quality
> > or on how to write bad SQL. We have poor data quality in database, so
> > this is a good topic. We also have new SQL programers who are
> > determined to write bad code, so perhaps a book that shows them the
> > common errors would help.
>
> Damn, that's a good topic!
>
> When I think of the number of bad databases I've seen, and the number of
> bad queries I've seen against pretty good databases, I think there's a
gold
> mine there. And the thing is, the same errors seem to keep on cropping
up.
> People have these fixed ideas about how they can improve on the relational
> model, and reduce the number of joins, without ever really getting a
clear
> idea of how the engine really works. And they don't know how to map
reality
> into relations!
>
> I suppose, if you called it something like "SQL from Dummies", you'd get
> sued. Good luck, Joe!
> --
> Regards,
> David Cressey
> www.dcressey.com
>
>
Received on Thu Dec 19 2002 - 01:14:38 CET

Original text of this message