Re: Optimization of query finding related products for a certain product

From: Bob Badour <bbadour_at_golden.net>
Date: Sun, 30 Sep 2001 00:31:40 -0400
Message-ID: <Iext7.1501$6b2.105106451_at_radon.golden.net>


"Anurag Varma" <avdbi_at_nospam.hotmail.com> wrote in message news:js8n7.91097$tb.9032543_at_news02.optonline.net...
> Hi,
>
> "Bob Badour" <bbadour_at_golden.net> wrote in message
> news:cd3b3cf.0109091615.41062c6e_at_posting.google.com...
> >
> > Yuck! Take a weak optimizer and render it completely useless? Do you
> > really think that's helpfull
> >
> > If, after all of that, the optimizer simply handles "IN" clauses
> > poorly, I would suggest trying logical equivalents using "= ANY" or
> > "EXISTS", which some dbmses handle better.
>
> Usually (maybe always) Oracle handles =ANY same way as IN.
> If the parent query is returning a lot of rows then using EXISTS might
> be worse!

A good optimizer should perform equally well for all logical equivalents, but good luck finding one of those!

> > If the dbms supports
> > subqueries in the "FROM" clause, rewrite the query using a join
> > between VISIT and the subquery.
> >
> > I wouldn't recommend using cursors under any circumstances. Using
> > procedural methods prevents the optimizer from ever doing its job.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Whoever said that!!

By what method does the compiler of any procedural language perform algorithmic replacement?

> There are *some* cases in which using procedural method is the best way to
> go.

Not when one has a decent optimizer.

>
> Anurag
>
>
Received on Sun Sep 30 2001 - 06:31:40 CEST

Original text of this message