explain the plan using plan_hash_value and runtime
Hello
Please let me know the syntax to get the plan to explain using sql_id and plan_hash_value.
Also let me know how to find out the same sql execution times in the previous months. I have the ID value of sql.
Kind regards
VN
> Is it possible to check how long the sql finished in the previous months?
Of AWR / StatsPack reports.
Or use awrsqrpt.sql which can query the repository for a single SQL_ID AWR.
However, you must have the AWR data kept for 4 months. The default retention is 7 days.
Hemant K Collette
Tags: Database
Similar Questions
-
a sql id have more than explain the plan so I'd like to come up with plan used at runtime.
Hi all
In a sql oracle11g having id several explain the plan so I'd like to come up with plan used at runtime.
For example SQlID:-8yczg5zav14vt have 5 sql plan and I want to check that we execute at any time, please let me how I can check by sql queries
Concerning
Ranjeet
RanjeetSohale wrote:
I am ok for that but active only plans is right, but in accordance with the foregoing, two data line table in the table SQL V$ so both active and plan cost is high and the other is low.
Yes that's right cost is different, he means here another effective plan for oracle will analyze the declaration again and stored as new slider of the child. Especially since I explained that.
-
can you explain the purpose of layout and describe when it should be used? __
can you explain the purpose of layout and describe when it should be used?
http://www.Google.com
Use a more specific search term. This will help you get a good answer for your homework. ;-) MS - MVP - Elephant Boy computers - don't panic! -
LightroomCC2015 disabled just use of the develop Module. Indicating that I need to buy a license. I'm running on the plan for this and other applications. How do I fix this, please?
Please see the troubleshooting section below.
Reference: creative judgment Cloud 2015 to return to the mode of trial
Let us know if that helps.
Kind regards
Mohit
-
Hello world
could someone please provide me with details of explained the plan and I would appreciate some related details explain plan, trace and tkprof
Thank you
ShareefHello
PLAN of EXPLAINING is an Oracle utility that analyzes a statement and shows the expected execution plan. It may be different from the implementation plan real for a number of reasons.
Extended SQL trace (10046 event) is a way to gather advanced diagnostic information. There are different levels, at levels 8 and 12 provide the greatest level of detail (you will be able to see the events of waiting and the bind variable values).
TKProf is a utility that processes the raw trace files and makes shaped the output in a more readable way. However, some experts prefer to work with trace files "gross" - they are not so difficult to read, especially if you get some practice.
There are other events of tracing: 10053 allows you to see what is happening inside the Oracle optimizer, 10104 allows to see the stats of hash etc join.
Best regards
Nikolai -
difference between the execution plan and explain the plan?
What is the difference between the execution plan & explain the plan?an execution plan is the actual steps that oracle will pass by when it executes a query.
explain plan is a tool that is used to generate the steps of an execution plan for a query.
-
Generation to EXPLAIN the PLAN on a database that is open in READ ONLY mode
Hello
I use the Oracle 10.2.0.3 version.
If my database is opened in READ ONLY mode, means that no insert/update/delete operations are allowed here.
During the generation of the PLAN to EXPLAIN this, the PLAN_TABLE registrations for any SQL. But my database is opened in READ ONLY mode, means that no inserts can happen.
So, how can I generate EXPLAIN PLAN for my SQL in this State?
Thanks in advance.
Best regards
oratestoratest wrote:
I use the Oracle 10.2.0.3 version.If my database is opened in READ ONLY mode, means that no insert/update/delete operations are allowed here.
During the generation of the PLAN to EXPLAIN this, the PLAN_TABLE registrations for any SQL. But my database is opened in READ ONLY mode, means that no inserts can happen.
So, how can I generate EXPLAIN PLAN for my SQL in this State?
You can always do: 'explain the plan in some_table@remote_database' to avoid inclusion in the local database. Unfortunately 10g added an extraction of the sequence of the code "explain plan", and that's where the call fails if you have tried this distant approach on your version.
Here's an idea that I have not tested. If you configure a link of data to your database from production to the database read-only, you could then do a "explain plan" in the database of production for the SQL statement by changing each object reference in the SQL statement to "object@readonlydatabase". In most cases this will allow the optimizer to recognize the statement as "entirely to distance" and get the optimizer on the readonly database to create the execution plan - which will be then written into the production database.
Concerning
Jonathan Lewis -
Explain the plans differ as the parameter value changes
Hi all
My colleague posted a similar question a few days before. Happened because of some bad index. But now we are in a strange situation.
DB:
We use the query below and was working fine until 13.SQL> select * from v$version; BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod PL/SQL Release 10.2.0.1.0 - Production CORE 10.2.0.1.0 Production TNS for 32-bit Windows: Version 10.2.0.1.0 - Production NLSRTL Version 10.2.0.1.0 - Production
It shows a hash join and nested with cost 16963 loops and gives the result in 2-3 seconds. It gives the same plan to explain even now if we use batch_id = '130609'SQL> explain plan for 2 SELECT * 3 FROM gacc_dtl_v1 acc, 4 gcus_dtl_v1 cus, 5 gtxn_dtl_v1 txn 6 WHERE txn.customer_id = cus.customer_number(+) 7 AND txn.batch_id = cus.batch_id(+) 8 AND txn.account_number = acc.id 9 AND acc.batch_id = '130609' 10 AND cus.batch_id(+) = '130609' 11 AND txn.batch_id = '130609' AND cus.target IN ('30'); Explained. SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------- Plan hash value: 566819363 ------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 947 | | 16963 (1)| 00:03:24 | | 1 | NESTED LOOPS | | 1 | 947 | | 16963 (1)| 00:03:24 | |* 2 | HASH JOIN | | 41 | 26322 | 9136K| 16799 (1)| 00:03:22 | |* 3 | TABLE ACCESS BY INDEX ROWID| GTXN_DTL_V1 | 31055 | 8764K| | 2430 (1)| 00:00:30 | |* 4 | INDEX RANGE SCAN | GTXN_V1_BATCHID_NDX | 60524 | | | 156 (2)| 00:00:02 | |* 5 | TABLE ACCESS BY INDEX ROWID| GCUS_DTL_V1 | 176K| 59M| | 10869 (1)| 00:02:11 | |* 6 | INDEX RANGE SCAN | IDX_CUS2_V1 | 198K| | | 527 (2)| 00:00:07 | | 7 | TABLE ACCESS BY INDEX ROWID | GACC_DTL_V1 | 1 | 305 | | 4 (0)| 00:00:01 | |* 8 | INDEX RANGE SCAN | GACC_DTL_V1_IDX | 1 | | | 3 (0)| 00:00:01 | ------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access("TXN"."CUSTOMER_ID"="CUS"."CUSTOMER_NUMBER" AND "TXN"."BATCH_ID"="CUS"."BATCH_ID") 3 - filter("TXN"."CUSTOMER_ID" IS NOT NULL) 4 - access("TXN"."BATCH_ID"='130609') 5 - filter("CUS"."TARGET"='30') 6 - access("CUS"."BATCH_ID"='130609') 8 - access("TXN"."ACCOUNT_NUMBER"="ACC"."ID" AND "ACC"."BATCH_ID"='130609') filter(SUBSTR("TXN"."ACCOUNT_NUMBER",1,3)=SUBSTR("ACC"."ID",1,3)) 26 rows selected.
Now all of a sudden from yesterday it gives different explain the plan below. Only difference in the query below is the value of batch_id
It shows two loops nested with cost 77, but works for hours. Very very slow.. No idea what's going on...SQL> explain plan for 2 SELECT * 3 FROM gacc_dtl_v1 acc, 4 gcus_dtl_v1 cus, 5 gtxn_dtl_v1 txn 6 WHERE txn.customer_id = cus.customer_number(+) 7 AND txn.batch_id = cus.batch_id(+) 8 AND txn.account_number = acc.id 9 AND acc.batch_id = '150609' 10 AND cus.batch_id(+) = '150609' 11 AND txn.batch_id = '150609' AND cus.target IN ('30'); Explained. SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------ Plan hash value: 773603995 -------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 947 | 77 (0)| 00:00:01 | | 1 | NESTED LOOPS | | 1 | 947 | 77 (0)| 00:00:01 | | 2 | NESTED LOOPS | | 1 | 594 | 73 (0)| 00:00:01 | | 3 | TABLE ACCESS BY INDEX ROWID| GACC_DTL_V1 | 1 | 305 | 4 (0)| 00:00:01 | |* 4 | INDEX RANGE SCAN | GACC_DTL_BATCH_ID_INDX | 1 | | 3 (0)| 00:00:01 | |* 5 | TABLE ACCESS BY INDEX ROWID| GTXN_DTL_V1 | 1 | 289 | 69 (0)| 00:00:01 | |* 6 | INDEX RANGE SCAN | IDX_TXN2_V1 | 125 | | 12 (0)| 00:00:01 | |* 7 | TABLE ACCESS BY INDEX ROWID | GCUS_DTL_V1 | 1 | 353 | 4 (0)| 00:00:01 | |* 8 | INDEX RANGE SCAN | IDX_CUS3_V1 | 1 | | 3 (0)| 00:00:01 | -------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - access("ACC"."BATCH_ID"='150609') 5 - filter("TXN"."CUSTOMER_ID" IS NOT NULL AND "TXN"."BATCH_ID"='150609') 6 - access("TXN"."ACCOUNT_NUMBER"="ACC"."ID") filter(SUBSTR("TXN"."ACCOUNT_NUMBER",1,3)=SUBSTR("ACC"."ID",1,3)) 7 - filter("CUS"."TARGET"='30') 8 - access("CUS"."BATCH_ID"='150609' AND "TXN"."CUSTOMER_ID"="CUS"."CUSTOMER_NUMBER") filter("TXN"."BATCH_ID"="CUS"."BATCH_ID") 26 rows selected.
We are also do not understand why the filter (SUBSTR ("TXN". ""»(, 1, 3) ACCOUNT_NUMBER = SUBSTR ("VAC". " ID", 1, 3)) is used in both queries.select i.table_name,i.index_name,index_type,c.column_name,c.column_position,e.column_expression from all_indexes i, all_ind_columns c,all_ind_expressions e where c.index_name = i.index_name and e.index_name(+) = i.index_name and i.table_name in ('GCUS_DTL_V1','GACC_DTL_V1','GTXN_DTL_V') order by 1,2,4 TABLE_NAME INDEX_NAME INDEX_TYPE COLUMN_NAME COLUMN_POSITION COLUMN_EXPRESSION -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GACC_DTL_V1 GACC_DTL_BATCH_ID_INDX NORMAL BATCH_ID 1 GACC_DTL_V1 GACC_DTL_V1_IDX NORMAL BATCH_ID 2 GACC_DTL_V1 GACC_DTL_V1_IDX NORMAL ID 1 GACC_DTL_V1 GACC_DTL_V1_IDX2 FUNCTION-BASED NORMAL SYS_NC00101$ 1 SUBSTR("ID",1,3) GACC_DTL_V1 IDX_ACC1_V1 NORMAL CATEGORY 1 GACC_DTL_V1 IDX_ACC3_V1 FUNCTION-BASED NORMAL SYS_NC00099$ 1 "CUSTOMER_NUMBER"||'.'||"LIMIT_REF" GACC_DTL_V1 IDX_ACC4_V1 FUNCTION-BASED NORMAL SYS_NC00100$ 1 "CUSTOMER_NUMBER"||'.000'||"LIMIT_REF" GACC_DTL_V1 IDX_ACC5_V1 NORMAL POSTING_RESTRICT 1 GACC_DTL_V1 IDX_CUS5_V1 NORMAL CUSTOMER_NUMBER 1 GACC_DTL_V1 IDX_CUS6_V1 NORMAL LIMIT_REF 1 GCUS_DTL_V1 GCUS_DTL_V1_IDX1 NORMAL CUSTOMER_NUMBER 1 GCUS_DTL_V1 IDX_CUS2_V1 NORMAL BATCH_ID 1 GCUS_DTL_V1 IDX_CUS3_V1 NORMAL BATCH_ID 1 GCUS_DTL_V1 IDX_CUS3_V1 NORMAL CUSTOMER_NUMBER 2 GCUS_DTL_V1 IDX_CUS3_V1 NORMAL INDUSTRY 4 GCUS_DTL_V1 IDX_CUS3_V1 NORMAL SECTOR 3 GCUS_DTL_V1 IDX_CUS4_V1 FUNCTION-BASED NORMAL SYS_NC00078$ 1 SUBSTR("DATE_STAMP",1,6)
All tables are analyzed today.
Please share your thoughts on this.
Thanks in advance,
JacJac says:
L H NUM_BUCKETS LAST_ANALYZED SAMPLE_SIZE HISTOGRAM ------------------------------------------------------------------------------------------------------------------------------------------------ 010109 311208 235 13/Jun/2009 5,343 FREQUENCY
You have a histogram of frequencies on the BATCH_ID column missing at least 2 values according to your index statistics (235 buckets vs 237 separate keys).
If the value that you use in the query is missing then this could be the explanation for the estimation of cardinality bad (since you're on pre - 10.2.0.4. In 10.2.0.4 that this behavior changes).
The size of the sample of 5 300 lines is also very low, given the 57,000,000 lines according to the index statistics.
You have two options (which can be combined):
-Increase the size of the sample using a parameter explicitly estimate_percent, for example at least 10 percent
exec DBMS_STATS. GATHER_TABLE_STATS (null, 'GACC_DTL_V1', estimate_percent-online 10, method_opt => 'FOR COLUMNS SIZE 254 BATCH_ID,' waterfall-online fake)
-Get rid of the histogram
exec DBMS_STATS. GATHER_TABLE_STATS (null, 'GACC_DTL_V1', method_opt-online 'FOR BATCH_ID COLUMNS SIZE 1', cascade-online fake)
Note: Is there a particular reason why you store numbers in varchar columns? This might be the reason why Oracle believes that it must generate a histogram using the AUTO SIZE option.
I tend to promote to remove from the histogram, but you must first verify the data if the BATCH_ID values are spread out and the histogram is reasonable:
select batch_id , count(*) from gacc_dtl_v1 group by batch_id;
No constarints are at the DB level. All are processed Application level.
Have you checked this in DBA/ALL/USER_CONSTRAINTS?
It's also a good idea to have constraints at the level of the DB. It keeps your data consistent and quite often helps the optimizer. It allows even 10.2 and later to make things like the elimination of a join table that can make a huge difference in performance.
Kind regards
RandolfOracle related blog stuff:
http://Oracle-Randolf.blogspot.com/SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676 /.
http://sourceforge.NET/projects/SQLT-pp/Published by: Randolf Geist on June 16, 2009 11:48
Comment added constraints
-
explain the plan of a query with variables
Trying to Explain plan at some sql code in sql * more. The query has a variable. How can I do this?
I look to explain the plan and dbms_xplan but did not find anything with variablesuse sqlplus variable bind:
SQL> --define variable SQL> var x varchar2 SQL> -- notice the colon prefixing the variable SQL> explain plan for select * from customer where cid = :x; Explained. SQL> select * from table( dbms_xplan.display ); PLAN_TABLE_OUTPUT ----------------------------------------------------------------------------------------------- Plan hash value: 1709312366 ---------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 67 | 2 (0)| 00:00:01 | | 1 | TABLE ACCESS BY INDEX ROWID| CUSTOMER | 1 | 67 | 2 (0)| 00:00:01 | |* 2 | INDEX RANGE SCAN | CID | 1 | | 1 (0)| 00:00:01 | ---------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access("CID"=:X) 14 rows selected.
the variable should not be set to explain the request, because explain does not actually run.
Published by: shoblock on November 6, 2008 16:51
-
its ridiculous... I asked for the plan a month and cloud it recharges on a monthly basis and now when I try to cancel the membership that it does not show the desired option...
Cancel your membership creative cloud
To the link below, click on the still need help? option in the blue box below and choose the option to chat or by phone...
Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache. If he continues to not try to use a different browser. -
I got the plan of photography and you want to buy LR6
I bought the plan of photography and now I think to change to LR6. So can I go get the upgraded version?
If his power. How can I get the code of my package?
If you have an earlier version of Lightroom, which is v2 - v5, you can use them to upgrade. It is not a path to upgrade between CC and LR 6...
-
explain the plan against the eve...
I have a DDL which takes a long time to run on the primary
would like to know how long it takes if I switch to sleep mode and run education instead of the primary current standby... is possible to run explain sleep agasint plan without having to go through the whole process of switch?
I tried but the statement explain plan is a failure... Statement requires write Victorian for table plan and may not write in the plan table because db is not open... :) perhapts a new feature to implement in oracle 12g? :)
:)
v11.2.0.2
physical standbybe nice if we could run explains the plan for the system of relief through the primary system :) maybe in 12g?
do not know now. :)
-
why sometimes the trace file does not explain the plan?
Hello
Sometimes, when I 'alter session set sql_trace = true' and run some querys, some of them don't see explained the plan in the trace file?
I tried "alter system RAS shared_pool" before starting the trace, but not luck.
(Oracle 10g R2)
any ideas?
Thnks
Miguel
Published by: jmmnunes on Apr 27, 2010 18:01some of them don't watch not explain the plan in the trace file?
Log out of your session after you set the trace sql false?
All cursors must be closed to have access to all the information from the row source in the trace file.
-
IPhone 7, there will be an adapter jack allowing the two using headphones AND charger?
IPhone 7, there will be an adapter jack allowing the two using headphones AND charger?
Hello
Apple has not yet announced a.
You can submit your comments and suggestions to Apple here:
-
Our two new printers Laserjet Pro M201dw are not recognized on the office network. I have spent hours trying to understand this and posted questions on the forum Support HP, but without response. They became more disadvantages than thay are worth. And that's enough. Then I explained the problem to management and they said 'don't buy it not all HP printers more.'
Thanks for the suggestions.
I tried to BootP and disable ipv6 on a printer and at first, it worked (finally). But then, after having unplugged and restarted, he returned to the ip address of connection no.
So finally, I noticed and changed the setting of the link of "Automatic" to '100TX' speed full - and that seems to have solved the problem of intermittency. I've converted and turn it back on, unplugged, etc., and it maintains the connection and ip address.
Do not want to play with something that works, I can't say with certainty if the speed of one link would have solved the problem (probably not), but it seems that while your excellent suggestions finally established a network connection, the setting of explicit link speed was necessary to maintain the connection.
Thanks for your help in this matter!
Maybe you are looking for
-
How to use the "back" button to return to the new page tab in FF15
In FF14 I could(1) open the new tab and see the new tabs with thumbnails of page 9 page.2) click on a thumbnail and go to this page.(3) click on the back of FF button, who took me to the new tab page so I could click on some other thumbnail. In FF15
-
How one table based on another table on average?
Example: I have the ARRAY1 array with the following: 1 1 1 2 2 3 Array2 contains: 1 2 3 4 5 6 In the end, ARRAY3 would contain: 2 (1+2+3)/3 4.5 (4+5)/2 6 (6)/1
-
Instalar el visual studio 6.0 en window 2010 64-bit.
anteriormente trabajaba con pc e el window xp y el visual studio 6.0, ahora instale el window 2010 64-bit y el visual studio 2010, cuando intento trabajar con los trabajos pair in el anterior window 6.0 visual said sell me a message that exists incom
-
Hi guysCan someone help me? Game's WarBirds 2.77r (www.wbfree.net), the original platform was win98 / me. My game crashes when I try to change planes. I use to have the same problem when first tried to play in XP, but it was easy to fix - I had to un
-
cant' attach photos in hotmail in Windows XP
When I try to attach photos to an e-mail message written in hotmail, a window opens asking to install Silverlight windows already installed on my computer. I tried to remove Silverlight form IE outside computer then reinstall silverlight and then re-