Return-Path: <root@fatcity.cts.com>
Received: from newsfeed.cts.com (newsfeed.cts.com [209.68.248.164])
 by naude.co.za (8.11.2/8.11.2) with SMTP id g2EEUP418954
 for <oracle-l@naude.co.za>; Thu, 14 Mar 2002 09:30:25 -0500
Received: from fatcity.UUCP (uucp@localhost)
 by newsfeed.cts.com (8.9.3/8.9.3) with UUCP id GAA17460;
 Thu, 14 Mar 2002 06:24:30 -0800 (PST)
Received: by fatcity.com (26-Feb-2001/v1.0g-b70/bab) via UUCP id 00428D99; Thu, 14 Mar 2002 03:26:15 -0800
Message-ID: <F001.00428D99.20020314032615@fatcity.com>
Date: Thu, 14 Mar 2002 03:26:15 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: "Mark Leith" <mark@cool-tools.co.uk>
Sender: root@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: "Mark Leith" <mark@cool-tools.co.uk>
Subject: RE: SQL queries
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 70; ListGuru (c) 1996-2001 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: multipart/alternative;	boundary="----=_NextPart_000_0100_01C1CB43.859C1290"
------=_NextPart_000_0100_01C1CB43.859C1290
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Cheers Lee! One up for the "bad guys"! ;P
  -----Original Message-----
  From: root@fatcity.com [mailto:root@fatcity.com]On Behalf Of Robertson
Lee - lerobe
  Sent: 12 March 2002 16:24
  To: Multiple recipients of list ORACLE-L
  Subject: SQL queries


  All,

  Following SQL runs for ages (almost 2 hours)

  select * from table1 addr,
  table2 pers,
  table3 lookup
  table4 cust
  where cust.customer_key = lookup_customer_key
  and lookup_address_key = addr_address_key
  and lookup.person_key = pers.person_key
  and rownum < 1000;

  when this is changed to

  select /*+ FIRST_ROWS */
  ADDR.*,
  PERS.*,
  LOOKUP.*,
  CUST.*
  from table4 cust,
  table2 pers,
  table3 lookup
  table1 addr
  where cust.customer_key = lookup.customer_key + 0
  and lookup.address_key = addr.address_key
  and pers.person_key = lookup.person_key + 0
  and rownum < 1000;

  this runs instantaneously. I realise that 99.99% of the improvement is
down to the first_rows hint BUT, why does the SQL tool use the list of table
aliases with .* after it AND what on earth are the + 0s' on two lines of the
predicate list.

  Confused

  Lee

  PS. The Tool is SQLExpert brought to you by those nice blokes at
cool-tools (Cheers Mark Leith !!) and is proving absolutely priceless here
at the moment.


  TIA



  The information contained in this communication is
  confidential, is intended only for the use of the recipient
  named above, and may be legally privileged. If the reader
  of this message is not the intended recipient, you are
  hereby notified that any dissemination, distribution or
  copying of this communication is strictly prohibited.
  If you have received this communication in error, please
  re-send this communication to the sender and delete the
  original message or any copy of it from your computer
  system.


------=_NextPart_000_0100_01C1CB43.859C1290
Content-Type: text/html;
 charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D978572610-14032002><FONT face=3DArial color=3D#0000ff =
size=3D2>Cheers=20
Lee! One up for the "bad guys"! ;P</FONT></SPAN></DIV>
<BLOCKQUOTE>
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> root@fatcity.com=20
  [mailto:root@fatcity.com]<B>On Behalf Of </B>Robertson Lee -=20
  lerobe<BR><B>Sent:</B> 12 March 2002 16:24<BR><B>To:</B> Multiple =
recipients=20
  of list ORACLE-L<BR><B>Subject:</B> SQL queries<BR><BR></FONT></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2>All,</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>Following SQL runs=20
  for ages (almost 2 hours)</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>select * from=20
  table1 addr,</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>table2=20
  pers,</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>table3=20
  lookup</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>table4=20
  cust</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>where=20
  cust.customer_key =3D lookup_customer_key</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>and=20
  lookup_address_key =3D addr_address_key</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>and=20
  lookup.person_key =3D pers.person_key</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>and =
rownum &lt;=20
  1000;</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>when =
this is=20
  changed to</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>select /*+=20
  FIRST_ROWS */</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2>ADDR.*,</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2>PERS.*,</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2>LOOKUP.*,</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2>CUST.*</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>from =
table4=20
  cust,</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>table2=20
  pers,</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>table3=20
  lookup</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>table1=20
  addr</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial =
size=3D2>where=20
  cust.customer_key =3D lookup.customer_key + 0</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>and=20
  lookup.address_key =3D addr.address_key</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>and=20
  pers.person_key =3D lookup.person_key + 0</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>and =
rownum &lt;=20
  1000;</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>this =
runs=20
  instantaneously. I realise that 99.99% of the improvement is down to =
the=20
  first_rows hint BUT, why does the SQL tool use the list of table =
aliases with=20
  .* after it AND what on earth are the + 0s' on two lines of the =
predicate=20
  list.</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2>Confused</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2>Lee</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial size=3D2>PS. =
The Tool is=20
  SQLExpert brought to you by those nice blokes at cool-tools (Cheers =
Mark Leith=20
  !!) and is proving absolutely priceless here at the=20
moment.</FONT></SPAN></DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D093205915-12032002><FONT face=3DArial=20
  size=3D2>TIA</FONT></SPAN></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV><CODE><FONT =
size=3D3><BR><BR>The=20
  information contained in this communication is<BR>confidential, is =
intended=20
  only for the use of the recipient<BR>named above, and may be legally=20
  privileged. If the reader <BR>of this message is not the intended =
recipient,=20
  you are<BR>hereby notified that any dissemination, distribution =
or<BR>copying=20
  of this communication is strictly prohibited. <BR>If you have received =
this=20
  communication in error, please <BR>re-send this communication to the =
sender=20
  and delete the <BR>original message or any copy of it from your=20
  computer<BR>system.<BR></BLOCKQUOTE></FONT></CODE></BODY></HTML>

------=_NextPart_000_0100_01C1CB43.859C1290--

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mark Leith
  INET: mark@cool-tools.co.uk

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

