There is performance loss by using alias on oracle

Asked

Viewed 44 times

1

In oracle there is some performance loss, even small, when using alias for tables?

Examples:

select user.name from user;

and

select u.name from user u;

1 answer

3


Aliases do not impact the performance of a query.

Aliases refer to tables and columns, being possible to execute the query without them, so they do not impact the execution, since column and table names are evaluated before the execution, even before the Oracle engine determines the best execution plan.

What impacts either the columns used, the tables and the way they are linked and mainly what comes in the where, order, group, etc..

To be sure, I created a table with a similar structure to yours, ran the query with and without alias and showed the execution plan of the two, which was the same.

The result can be seen here:http://sqlfiddle.com/#! 4/c4cc9/2

| Id | Operation        | Name          | Rows  | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------------------------
| 0  | SELECT STATEMENT |               | 8168  | 16336 | 29 (0)     | 00:00:01 |
| 1  | COLLECTION ITERATOR PICKLER FETCH| 8168  | 16336 | 29 (0)     | 00:00:01 |

If you want to test, or if the link fails, here the script:

create table user_test (
   id int,
   name varchar(29)
);

insert into user_test values (1,'fulano');
insert into user_test values (2,'sicrano');

explain plan for
  SELECT name FROM user_test;

SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());

explain plan for
  SELECT u.name FROM user_test u;

SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY()); 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.