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: Query tuning with tablename alias

RE: Query tuning with tablename alias

From: Khedr, Waleed <Waleed.Khedr_at_FMR.COM>
Date: Wed, 20 Nov 2002 14:13:50 -0800
Message-ID: <F001.00508509.20021120141350@fatcity.com>


I do not think Oracle will run the sql below. Once you have an alias for a table, only that alias could be used as an alias (not the table name).  

Example:  

Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.2.0 - Production  

SQL> desc dual;

 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------
 DUMMY                                              VARCHAR2(1)
 

SQL> select a.dummy from dual a;  

D
-

X  

SQL> select dual.dummy from dual a;
select dual.dummy from dual a

       *
ERROR at line 1:
ORA-00904: "DUAL"."DUMMY": invalid identifier  

SQL> select dual.dummy from dual;  

D
-

X      

Waleed

-----Original Message-----

Sent: Wednesday, November 20, 2002 1:13 PM To: Multiple recipients of list ORACLE-L

Hello list.  

I have recently been tasked with trying to optimize some slow performing queries (Oracle 8.1.7) for an application that generates reports in a data warehouse type environment. I have noticed in most of the queries that the table names have been aliased, but not used elsewhere in the query.  

IE. SELECT table1.column1,

                      table1.column2,
                      table2.column1
       FROM     table1 A,
                      table2 B
       WHERE   table1.key = table2.key;
 

Are there any advantage/disadvantages to giving these tables aliases and not using them anywhere else? I am thinking that if the tables have been assigned alias names, they should be referred to by alias names, but I guess I have not seen anything documented on this officially. These queries join tables against remote tables in a different instance, if that makes a difference. Any insight on this would be great.                 

Thanks.

Wendy Hopper  

--

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

Author: Khedr, Waleed
  INET: Waleed.Khedr_at_FMR.COM

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services

---------------------------------------------------------------------
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 Wed Nov 20 2002 - 16:13:50 CST

Original text of this message

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