Home » RDBMS Server » Performance Tuning » Joins and in-line views (Oracle 11.2)
Joins and in-line views [message #571855] Mon, 03 December 2012 00:47 Go to previous message
lakshmis
Messages: 100
Registered: November 2008
Location: India
Senior Member
Hi All,

Please help me in understanding how joins work with in-line views.

I have a query and its explain plan as below:
SELECT e.ename,e.deptno,d.dname FROM 
dept d,
emp e 
WHERE e.deptno=d.deptno
AND e.deptno=20 
 
 
-----------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost  |
-----------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     5 |   210 |    11 |
|   1 |  HASH JOIN         |      |     5 |   210 |    11 |
|   2 |   TABLE ACCESS FULL| DEPT |     1 |    22 |     5 |
|   3 |   TABLE ACCESS FULL| EMP  |     5 |   100 |     5 |
-----------------------------------------------------------
 
Note
-----
   - 'PLAN_TABLE' is old version   


I read the docuemnt at: http://www.dba-oracle.com/oracle_tips_rittman_inlineviews.htm,
section "Using outer joins with in-line views", under which he demonstartes the use of in-line views.

I changed the above query to use in-line view.
The new query and its explain plan are as below:
SELECT e.ename,e.deptno,d.dname FROM 
dept d,
(SELECT * FROM emp WHERE deptno=20) e 
WHERE e.deptno=d.deptno
 
 
-----------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost  |
-----------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     5 |   210 |    11 |
|   1 |  HASH JOIN         |      |     5 |   210 |    11 |
|   2 |   TABLE ACCESS FULL| DEPT |     1 |    22 |     5 |
|   3 |   TABLE ACCESS FULL| EMP  |     5 |   100 |     5 |
-----------------------------------------------------------
 
Note
-----
   - 'PLAN_TABLE' is old version


I do not find any difference in both the explain plans. Both are same.

In my second query, the filtered rows will be joined to dept table. And hence the baggage will reduce.
But how can I verify that in-line view has worked better?


Regards,
Lakshmi.

[Updated on: Mon, 03 December 2012 00:55]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Improve DDL operation performance (2 Merged)
Next Topic: Query Sql Server faster than Oracle
Goto Forum:
  


Current Time: Tue May 21 05:34:53 CDT 2013

Total time taken to generate the page: 0.19943 seconds