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: DENNIS WILLIAMS <DWILLIAMS_at_LIFETOUCH.COM>
Date: Wed, 20 Nov 2002 14:19:30 -0800
Message-ID: <F001.00508524.20021120141930@fatcity.com>


Wendy - Could this SQL have been generated by a program? Dennis Williams
DBA
Lifetouch, Inc.
dwilliams_at_lifetouch.com

-----Original Message-----
Sent: Wednesday, November 20, 2002 4:00 PM To: Multiple recipients of list ORACLE-L

Knowing about how a hint works with aliases is what made me wonder about impacts to other areas. I have never seen it mentioned in any of the manuals I have read, and I just thought maybe someone else had experience with this. I am trying to figure out why the developer of these queries took the time to assign alias names to all these table names in their FROM clause, and then never used them elsewhere in the SELECT or WHERE portions. Maybe they were copying from a template...

I realize there is a lot to be gained by moving the remote tables locally where possible. We are hoping to use local snapshots instead of going to remote instances.

Thanks again!

-----Original Message-----
Sent: Wednesday, November 20, 2002 4:19 PM To: Multiple recipients of list ORACLE-L

Wendy,

I have never heard of alias' providing either a performance gain or reduction. One thing I haven't verified though is the impact on hints. It has been my observation that if a table has an alias then that alias must be used in the hint. For example:

select /*+ index(user) */ *
from ctcs_user u;

Does not use an index, whereas:

select /*+ index(u) */ *
from ctcs_user u;

Does use an index.

If you queries are joining tables across instances, however, then I'd be looking there for performance issues. Oracle doesn't join across instances really - it tends to just temporarily copy one table to a different instance. (Someone technical can explain this properly).

Regards,

     Mark.  

                    "Hopper, Wendy

                    S"                   To:     Multiple recipients of list
ORACLE-L <ORACLE-L_at_fatcity.com>       
                    <wendy.hopper@       cc:

                    eds.com>             Subject:     Query tuning with
tablename alias                            
                    Sent by:

                    root_at_fatcity.c

                    om

 

 

                    21/11/2002

                    05:13

                    Please respond

                    to 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

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>

   Privileged/Confidential information may be contained in this message.

          If you are not the addressee indicated in this message
       (or responsible for delivery of the message to such person),
            you may not copy or deliver this message to anyone.
In such case, you should destroy this message and kindly notify the sender
           by reply e-mail or by telephone on (61 3) 9612-6999.
   Please advise immediately if you or your employer does not consent to
                Internet e-mail for messages of this kind.
        Opinions, conclusions and other information in this message
              that do not relate to the official business of
                         Transurban City Link Ltd
         shall be understood as neither given nor endorsed by it.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>

--

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

Author: Mark Richard
  INET: mrichard_at_transurban.com.au

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).
--

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

Author: Hopper, Wendy S
  INET: wendy.hopper_at_eds.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).
--

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

Author: DENNIS WILLIAMS
  INET: DWILLIAMS_at_LIFETOUCH.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:19:30 CST

Original text of this message

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