Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Tuning Question (8.1.7)

Re: SQL Tuning Question (8.1.7)

From: Jeremy <newspostings_at_hazelweb.co.uk>
Date: Thu, 6 May 2004 07:15:10 +0100
Message-ID: <MPG.1b03e846492be4bd989bdd@news.individual.net>


In article <XEfmc.69664$Jy3.11643_at_fed1read03>, Anna C. Dent says...
> Jeremy wrote:
> > Hi Guys, what's the best resource (on the web) to look at for info on
> > tuning SQL and defining suitable indexes for a query (at this point I
> > expect someone to say you don't create indexes for a query, they should
> > be a part of the overall application design)? I am
> >
> > A couple of specific questions:
> > 1) I do an explain of a query such as
> > select a.tab1.id
> > from tab1 a, tab2 b
> > where a.id = b.id
>
> Why are you selecting from TAB2 B
> when NOTHING from that table is actually being returned.
> ONLY tables which contribute 1 or more columns to the SELECT clause
> should exist in the FROM clause.
>
> select a.tab1.id
> from tab1 a
> where exists (Select '1'
> FROM tab2 b
> WHERE a.id = b.id)
>

It was a simplified example - but in the case you describe is it therefore more efficient to use an 'EXISTS' than to join the table directly (when it is just for the purposes you describe, i.e. where you don't actually want any data from that table)?

-- 

jeremy
Received on Thu May 06 2004 - 01:15:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US