Help : Understanding the Explain Plan [message #249901] |
Fri, 06 July 2007 08:19 |
orasaket
Messages: 70 Registered: November 2006
|
Member |
|
|
Hi,
I am using Oracle 9i R2 on Linux
Please refer following query and Explain Plan
select * from com_process_log where nprocessid in(select nparamcd from com_param_system_m where nparamcd=702);
--------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
--------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 62 | 2790 | 74 |
| 1 | TABLE ACCESS BY INDEX ROWID| COM_PROCESS_LOG | 17 | 714 | 18 |
| 2 | NESTED LOOPS | | 62 | 2790 | 74 |
| 3 | SORT UNIQUE | | | | |
| 4 | INDEX FAST FULL SCAN | XPKCOM_PARAM_SYSTEM_M | 4 | 12 | 3 |
| 5 | INDEX RANGE SCAN | XPKPROCESS_LOG | 17 | | 7 |
--------------------------------------------------------------------------------------
There is Composite index on IPARAMTYPECD, NPARAMCD
CREATE UNIQUE INDEX XPKCOM_PARAM_SYSTEM_M ON COM_PARAM_SYSTEM_M(IPARAMTYPECD, NPARAMCD)
Following is the existing data
com_param_system_m = 1534 rows
distinct values for iparamtypecd = 45
com_process_log = 61912 rows
My Queries are,
How come we have 'FAST FULL SCAN' of XPKCOM_PARAM_SYSTEM_M instead of 'SKIP SCAN'?
Is it because of NPARAMCD being NOT NULL?
We have a single row returning for this query
What does the ROWS field in PLAN show - 4?
What is SORT(UNIQUE) in the Plan?
How the Nested Join is formed here?
I believe it would be beween the following
rows returned from Index acceess of com_param_system_m
rows returned from com_process_log table - retrieved from rowid access using index xpkcom_process_log
Please Advice
Also if i am changing my query as below, why com_param_system is doing FTS?
Also why after nested loop join we are accessing com_process_log table again?
select * from com_process_log cpl,cpsm where nprocessid =nparamcd and nparamcd=702
--------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 93 | 8928 | 93 |
| 1 | TABLE ACCESS BY INDEX ROWID| COM_PROCESS_LOG | 17 | 714 | 18 |
| 2 | NESTED LOOPS | | 93 | 8928 | 93 |
| 3 | TABLE ACCESS FULL | CPSM | 5 | 270 | 5 |
| 4 | INDEX RANGE SCAN | XPKPROCESS_LOG | 17 | | 7 |
--------------------------------------------------------------------------------
Please advice
Thanks and Regards,
OraSaket
|
|
|
|
Re: Help : Understanding the Explain Plan [message #249966 is a reply to message #249901] |
Fri, 06 July 2007 11:12 |
orasaket
Messages: 70 Registered: November 2006
|
Member |
|
|
Superb !!
Michel thanks for the explaination.
I have one important query on this.
When you seniors start looking in to the queries posted by us,for Tuning, what is you starting point?
First you check joins, Then Index Access or something else?
In case you are first checking 'how data is filtered throgh where clauses or between joins', can you suggest me any thumb rules?
I know this is very generic question but these inputs will help me alot.
Thanks and Regards,
OraSaket
|
|
|
|
|
|