http://nimishgarg.blogspot.ae/2015/09/how-to-get-execution-plan-and.html
How do you check EXECUTION PLAN of a QUERY? I got this question on my facebook chat many times. "EXPLAIN PLANE" The answer was quite simple, Right? Actually it depends on what I am looking for. "AUTOT TRACE" is my personal favourite but I use one of the following depending on various situations.
1) EXPLAIN PLAN
2) AUTOT TRACE
3) DBMS_XPLAN.DISPLAY_CURSOR
4) SQL TRACE (10046)and TKPROF
Lets execute them to have an idea on how these methods are different and what information one provides and other doesn't.
1) EXPLAIN PLAN (basic and simple)
SQL> explain plan for select * from dual;
Explained.
SQL> SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
PLAN_TABLE_OUTPUT
----------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
----------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 2 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 |
----------------------------------------------------------
Note
-----
- 'PLAN_TABLE' is old version
11 rows selected.
2) AUTOT TRACE (PLAN + STATS)
SQL> set autot trace
SQL> select * from dual;
Execution Plan
----------------------------------------------------------
----------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
----------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 2 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 |
----------------------------------------------------------
Note
-----
- 'PLAN_TABLE' is old version
Statistics
----------------------------------------------------------
25 recursive calls
13 db block gets
34 consistent gets
1 physical reads
3060 redo size
208 bytes sent via SQL*Net to client
362 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
3) DBMS_XPLAN.DISPLAY_CURSOR (PLAN + OTHER DETAILS)
SQL> SELECT * FROM DUAL;
D
-
X
SQL> SELECT SQL_ID FROM V$SQL WHERE SQL_TEXT LIKE 'SELECT * FROM DUAL%';
SQL_ID
-------------
9g6pyx7qz035v
SQL> select * from table(dbms_xplan.display_cursor('9g6pyx7qz035v',NULL,'ADVANCED'));
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------
SQL_ID 9g6pyx7qz035v, child number 0
-------------------------------------
SELECT * FROM DUAL
Plan hash value: 3543395131
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100)| |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / DUAL@SEL$1
Outline Data
-------------
/*+
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------
BEGIN_OUTLINE_DATA
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('11.2.0.3')
DB_VERSION('11.2.0.3')
ALL_ROWS
OUTLINE_LEAF(@"SEL$1")
FULL(@"SEL$1" "DUAL"@"SEL$1")
END_OUTLINE_DATA
*/
Column Projection Information (identified by operation id):
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------
1 - "DUAL"."DUMMY"[VARCHAR2,1]
Note
-----
- SQL plan baseline SQL_PLAN_c7fbanxudy9yvef6f73b0 used for this statement
41 rows selected.
4) SQL TRACE (10046)and TKPROF
Click here to know how to generate trace files and execute TKPROF in simple steps.
http://nimishgarg.blogspot.com/2010/10/oracle-tkprof-simple-steps.html
Thanks for sharing this blog.
ReplyDeleteOracle DBA Training in Chennai | Oracle Training in Chennai
Quickbooks enterprise support Phone number Solve your Quickbooks errors.
Contact us and get 24*7 Quickbooks Enterprise support and get fixed Quickbooks errors by our certified Quickbooks Enterprise Support team. (+1 (833) 400-1001)
Error occurrence like password errors, login errors, signup errors, puzzle captcha not working are the common errors faced by the users every now and then. If you’re dealing with any of the above issues, you can reach the expert0073 by dialing Binance customer support number. They are known for providing the out-of-the-box experts services. They will offer handy and prompt solutions and remedies experts team. You can approach them any time as they are available 24/7 to assist the Binance users. Blockchain Support Number
ReplyDeleteError occurrence like password errors, login errors, signup errors, puzzle captcha not working are the common errors faced by the users every now and then. If you’re dealing with any of the above issues, you can reach the expert0073 by dialing Binance customer support number. They are known for providing the out-of-the-box experts services. They will offer handy and prompt solutions and remedies experts team. You can approach them any time as they are available 24/7 to assist the Binance users. Blockchain Support Number
ReplyDeleteIs your Binance account not working? Are you facing login Issues in Binance? This errors sound minor bit can create big problem for the user if not fixed on time. Binance team is completely trained and know all the possibilities to end all the worries and provide the desired results in a quick time. In a stepwise manner. You can reach the professionals by dialing Binance customer care number. Technical issues occur abruptly and are the main reason of unwanted problems. Therefore, you can always contact the team who is always at your service for help. Binance Support number
ReplyDeleteIs your Coinbase puzzle captcha not working? In order to get solutions and remedies, you can call to the skilled executives by dialing Coinbase Support Number. The experts are active all day and night for assistance and support. You can avail their customer services without taking time into consideration as it is 24/7 approachable. The experts have all the means and methods to fix your issues in a jiffy with high-end perfection. Our team will address your queries and make sure to deliver the ways that can diminish your issues in quick time. Coinbase Support number
ReplyDeleteUseful Information, your blog is sharing unique information....
ReplyDeleteThanks for sharing!!!
Oracle Java Certifications
Nice blog! Thanks for sharing this valuable information
ReplyDeleteAWS Training in Bangalore
AWS Training in Pune
canlı sex hattı
ReplyDeletejigolo arayan bayanlar
heets
XM26QA
Thank you for sharing this insightful blog post. I found it to be informative. The points you've raised are both relevant and well-researched. Visit to AWS Classes in Pune
ReplyDelete