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

Home -> Community -> Mailing Lists -> Oracle-L -> Re[2]: table aliases save time when parsing??

Re[2]: table aliases save time when parsing??

From: <dgoulet_at_vicr.com>
Date: Tue, 10 Jul 2001 06:26:43 -0700
Message-ID: <F001.003456EE.20010710062523@fatcity.com>

Igor,

    Square hit as I remember it. I've read a couple of items from oriole corp and while I have never found anything they've written to be wrong, they have been less than completely clear on the why's and wherefores as in this case.

Dick Goulet

____________________Reply Separator____________________
Author: "Igor Neyman" <ineyman_at_perceptron.com>
Date:       7/10/2001 5:26 AM

Well, it's not aliases themselves, but the practice of using aliases as prefixes, when referring to columns:

SELECT t1.col1, t1.col2, t2.col1
FROM table1 t1, table2 t2
WHERE t1.col2 = t2.col2

that's what saves time when parsing: this way you tell the parser which table column list to look for, otherwise (when no prefixes used) it has to search through all tables column lists for particular column definition (and also to make sure, that this column name is unique in all column lists - if not you'll be getting an error, if not using prefixes).

But, you can get the same result (save time on parsing), when using table names as prefixes:

SELECT table1.col1, table1.col2, table2.col1 FROM table1, table2
WHERE table1.col2 = table2.col2

It's just that aliases are usually short (while table names could be long), and it's easier to read the code.

List, please correct me, if I'm wrong.

Igor Neyman, OCP DBA
Perceptron, Inc.
(734)414-4627
ineyman_at_perceptron.com   

  Hi,
    was reading CorrelatedSubqueries.pdf from oriole corp.   In fact it's good programming practice to use aliases in every situation where more than one table is referred to in a statement, since it saves time when parsing.

  Can some one please explain how it helps?

  coz
  I am a
  novice
  Oracle Certifiable DBBS

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4522.1800" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Well, it's not aliases themselves, but the practice of using
aliases as prefixes, when referring to columns:</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>SELECT&nbsp;t1.col1, t1.col2, t2.col1</FONT></DIV>
<DIV><FONT size=2>FROM table1 t1, table2 t2</FONT></DIV>
<DIV><FONT size=2>WHERE t1.col2 = t2.col2</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>that's what saves time when parsing: this way you tell the
parser which table column list to look for,&nbsp;otherwise&nbsp;(when no prefixes used) it&nbsp;has&nbsp;to search through all tables column lists for particular column definition (and&nbsp;also to make sure, that this column name is unique in all column lists - if not you'll be getting an error, if not using prefixes).</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>But, you can get the same result (save time on parsing), when
using table names as prefixes:</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>
<DIV><FONT size=2>SELECT&nbsp;table1.col1, table1.col2, table2.col1</FONT></DIV>
<DIV><FONT size=2>FROM table1, table2</FONT></DIV>
<DIV><FONT size=2>WHERE table1.col2 = table2.col2</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>It's just that aliases are usually short (while table names could be long),

and it's easier to read the code.</DIV>
<DIV>&nbsp;</DIV>
<DIV>List, please correct me, if I'm wrong.</DIV></FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV>Igor Neyman, OCP DBA<BR>Perceptron, Inc.<BR>(734)414-4627<BR><A
href="mailto:ineyman_at_perceptron.com">ineyman_at_perceptron.com</A><BR>&nbsp;
<BR></DIV>
<BLOCKQUOTE dir=ltr

style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>   <DIV
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>   <A title=novicedba_at_hotmail.com
  href="mailto:novicedba_at_hotmail.com">novicedba</A> </DIV>   <DIV style="FONT: 10pt arial"><B>To:</B> <A title=ORACLE-L_at_fatcity.com   href="mailto:ORACLE-L_at_fatcity.com">Multiple recipients of list ORACLE-L</A>

  </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, July 10, 2001 7:10 
AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> table aliases save time when 
  parsing??</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp; was reading 
  <STRONG>CorrelatedSubqueries.pdf </STRONG></FONT><FONT face=Arial size=2>from 
  oriole&nbsp;corp.</FONT></DIV>
  <DIV><FONT face="Times New Roman" size=3><STRONG>In fact it's good programming

  practice to use aliases in every situation where more than one table is   referred to in a statement, since it saves time when </STRONG></FONT><I><FONT   face="Times New Roman" size=3><STRONG>parsin</STRONG></I></FONT><FONT   face="Times New Roman" size=3><STRONG>g.</STRONG></FONT></DIV>   <DIV><FONT face="Times New Roman" size=3></FONT>&nbsp;</DIV>   <DIV><FONT face="Times New Roman" size=3>Can some one please explain how it   helps?</FONT></DIV>
  <DIV><FONT face="Times New Roman" size=3>&nbsp;</DIV></FONT>   <DIV><FONT face=Arial size=2>coz<BR>I am a<BR>novice<BR>Oracle Certifiable   DBBS</FONT></DIV></BLOCKQUOTE></BODY></HTML>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: dgoulet_at_vicr.com

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_at_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).
Received on Tue Jul 10 2001 - 08:26:43 CDT

Original text of this message

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