Excution plan
hi
yesterday i have run one query its excuted normally,but today the query taking more time ,i want to check yesterday excution plan and current excution plan .How can i check before excutuion plan where it wil store ?
Whenever you read or write data in Oracle, you do so by issuing an SQL statement. One of Oracle's task when it receives such a statement is to build a query execution plan. An execution plan defines how Oracle finds or writes the data. For example, an important decision that Oracle has to take is if it uses indexes or not. And if there are more indexes, which of these is used. All this is contained in an execution plan.
If one wants to explore such an execution plan, Oracle provides the SQL statement EXPLAIN PLAN to determine this.
refer this link, surely it will helps you. try it
http://download.oracle.com/docs/cd/B10501_01/server.920/a96533/ex_plan.htm
Similar Messages
-
Excute Plan in Oracle SQL Develper
Hi ,
I am using Oracle SQL Developer , 1.5.3 version .
I have written , a basic query like select * from Trans_Master , and on to the IDE of SQL Developer when i used
Excute Explain Plan F6
It displayed results as
OPERATION as SELECT STATEMENT
OBJECT_NAME as TRANS_MASTER
OPTIONS as FULL
COST as *44*
Could anybody please tell me what does this mean ??
Please help , thanks in advance .Actually I think your question is a little too dark to be effective, if I'm not mistaken you are asking what the Explain plan and Autotrace functions in SQL Developer do.
If this is the case the answer is quite simple, the two functions provide you with a graphical way to display the operations the database will do internally when executing your query, with this information you can do tuning operations on your query to make it run faster or consume less database resources or the like.
In your example the information provided by SQL Developer is telling you that you are executing a select statement, and this statement is using the object TRANS_MASTER and doing a full table scan on it (natural since you provided no filters), when you start writing more complex queries with filters and joins you will see the plan change and evolve and you may want to modify your original query to get a better plan.
When you actually need to tune a particular query then you are indeed better of asking in the SQL And PL/SQL forum, since the guys there will undoubtedly answer your tuning questions faster and maybe even better. -
Batch Query takes too much time
Hi All,
A query as simple as
select * from ibt1 where batchnum = 'AAA'
takes around 180 seconds to give results. if I replace batchnum condition with itemcode or anything other than batchnum, the same query returns results in some 5 seconds. the IBT1 table has nearly 3 lac rows. Consequently, a little complex query involving batchnm conditions gives 'query execution time out' error.
what could be the reason? any resolution?
Thanks,
BinitaHello Binita,
You need some database tunning....
The IBT1 table has complex index on ItemCode, BatchNum, LineNum, WhsCode, and has no index on bacthnumber. But it has statistics, and statistics are useful for running queries ( see [ms technet here|http://technet.microsoft.com/hu-hu/library/cc966419(en-us).aspx]). Also there is a note about performance tunning databases 783183 .
There is 2 ways to "speed up" your query: indexes and statistics
Statistics
See the statistics of IBT1 table:
exec SP_HELPSTATS 'IBT1','ALL'
the result set you see : the statistics name ([IBT1_PRIMARY] and some statistics created by the system name likes WASys_XXXX. For Batchnum, you can execute the following statement:
DBCC SHOW_STATISTICS ('IBT1',_WA_Sys_00000002_4EE969DE)
--where _WA_Sys_00000002_4EE969DE is the name of the statistics of batchnum
Check the resultset. If the "updated", "rows","row sampled" columns. If necessary, you can update the statistics by:
-- update statistics on whole database
EXEC SP_UPDATESTATS
-- update all statistics of IBT1 table
UPDATE STATISTICS IBT1 WITH FULLSCAN
-- update a specific statistics of IBT1 table
UPDATE STATISTICS IBT1(_WA_Sys_00000002_4EE969DE) WITH FULLSCAN
Index defragmentation/reindex
If the index not contiguous, the seeking inside several fragmented files takes more time.
Execute your query in Management Studio Query analizer, and trun on Excution plans (CTRLL or CTRLM). This shows the compute cost of the query.
select * from ibt1 where batchnum = 'AAA'
result will be [IBT1_PRIMARY] index scan. You can check the fragmentation of the primary index of IBT1 table:
DBCC SHOWCONTIG ('IBT1') WITH FAST, TABLERESULTS, ALL_INDEXES, NO_INFOMSGS
In the resultset the column ScanDensity shows the fragmentation percent, This value is 100 if everything is contiguous; if this value is less than 100, some fragmentation exists.
Reindex can be done by the following statement:
DBCC DBREINDEX ('IBT1','IBT1_PRIMARY',100) WITH NO_INFOMSGS
Take care: all statements should NOT be execute during business hours.
This may helps you.
Regards,
J. -
Hello,
I am developing the custom heristics for Stable forward schduling for list of resource.
/SAP/APO/CDPSO- Stand T-code.
My objective to run the stable forward schduling for list of resources based on the prirotiy.
The Standard Stable forward schduling is calling FM : /SAPAPO/SFW_HEUR_FW_STABLE
there is standard BADI /SAPAPO/SFW_FW_STB for the same but it don't resolve the issue bcoz they needed to run after the this step.
We copied the standard FM along with Function group.
the table /SAPAPO/HEURFUNC is mainatianed with custom FM and heuristics setting to call this custom FM is maintained.
Now when you check the Standard FM there is standard method Excute Planning which do the functionality for the class
/SAPAPO/CL_SFW_HEUR_FW_STB;
in order to acheive the results the standard class is copied into Z_class and it enhance further to call execute planning to modify the contents based on product priority.
in the excute planing for the method get_next_set the custom method is called which changes the schedulde sort.
I am able to acheive using the above process but the results don't effect much after executed in custom step which defined above.
During my analysis i observed the method get_next_set already created that MT_SCHEDULDE_SORT and again after the get_next_set method i am calling my own method and changing the schdeulde_sort which is failing around.
Please check and let me know your thoughts for same.
let me know any further information needed for the same.
Thksyou can change the Std Heuristics with your Custom Heurstic with BADI's.
You can do it by BADI :/SAPAPO/RRP_HEUR_DO
Also check BADI:
/SAPAPO/RRP_PLANNING
Tcode for BADI :SE18/SE19.
Manish -
Unable to discover Why No Join Predicate
Please help me, I have this query:
select pc.Val,
PC2.Valstring as valstring,
pc.ValString as MessageType,
pc2.Val as Port
from dbo.tblproperty p with(nolock)
inner join dbo.tblpropertycfg pc with(nolock) ON p.pkPropertyID = pc.fkPropertyID
inner join dbo.tblpropertycfg pc2 with(nolock) ON p.pkPropertyID = pc2.fkPropertyID
where p.pkPropertyID = 5
and pc.Concept = 'PBX'
and pc2.Concept = 'PBXIP'
I am attaching the Excution Plan, this plan showing "No Join Predicate" Warning, I am unable to discover where is the problem, please help.Hi SathyanarrayananS:
Thank you for your support, when you say "are there any chance they are UDF or View" you mean if I could create and UDF or View with those tables?, because both tables are physical.
I am already readed the link and IMHO my query does not meets on any of examples provided.
As you can see, the first joins using the table, does not cause NJP, but when we apply the third join is when the NJP arise.
Do you need additional information about my schema?
Best regards. -
Please,
I have just migrated a database from one server to another powerful server, but the issue is that one of the sql statement is very very slowing down.
we downloaded the dump file to another server, and the same sql is very very fast.
I shrank/rebuilt , table/indexes but no changes found, I also created new indexes that show up into the excution plan,but nothing changed.
My Question:
There is another area where I could look at to tune this sql statment?
ThanksYou may need to consider two things here.
1. Make sure you keep the parameter optimizer_mode consistent between two databases? If not, you may experience performance degradation. Some legacy third-party application may still run upon RBO. That's what we ever experienced.
2. It's time to gather statistics. See below.
When to gather statistics:
Candidates
– After large amounts of data change (loads, purges, bulk
updates)
– New high/low values for keys generated
– Newly created tables
– Upgrading CPUs, I/O subsystem (system statistics)
– RBO to CBO migrations
– New database creations
An useful Oracle official doc available at http://www.oraclepoint.com/topic.php?filename=76&extra=page%3D1
Hope it helps.
Message was edited by:
R.Wang -
Hi,
I wanted to run window script or a query to fire the excution plan based on table column1--yes\No. if it is yes then it should start or triggered the execution plan automatically or it should not
thankshi,
expecting....reply -
Oracle forms hanging after tabbing off a field
Hi there,
Our application is 10gR2. There are several fields on the form and when the user tabs off a particular field (say TextField1), forms hangs up. TextField1 has a LOV associated but since i am clicking on the button of TextField1, the select statement associated with LOV will not be executed right?
There is no trigger attached to TextField1. This happens only on production and not on development database(replica of production).
Any suggestions for me???
Thanksthe execution plan has nothing to do with tabbing out of a field, it just is determined when the lov-query is executed first.
but the excution plan of a query is based on alot of information, besides the structure of the database (tables, indexes) it depends to a large amount on the statistics gathered in the database. The gathered statistics contain information of the data content of the tables and, and, and..
So if the data in your env-environment is very different from the data in your prod-environment, or even if the last gathering of statistics is long ago in your dev, the execution plan can be completly different in two databases although the structure is the same.
One reason for this problem may be is that in an dev-environment you sometimes have only a "small amount" of data to "save space". This can lead to totally different behaviour between dev-environment and prod-environment.
hope this helps. -
Is it True about SQLPLUS ?
Based on below link :
http://intermediatesql.com/index.php/tools/sqlplus-might-show-incorrect-explain-plan/
SQLPlus, while a useful tool, has its own share of problems that you need to be aware of ?
Any Idea is very appreciated.
Thanks.Interesting article. I left a nice long comment on that blog article. :-)
P. Forstmann, thanks for the link to the documentation - I think that Tom Kyte covered this limitation well in his books and in a couple of AskTom articles, but it was helpful to be able to be able to quote the documentation.
My comment attached to the blog article follows:
Please note that what you have reported in this blog article is in fact NOT a bug in SQL*Plus. Behind the scenes, SQL*Plus' AUTOTRACE facility uses an EXPLAIN PLAN FOR call to retrieve the execution plan for a submitted SQL statement. All bind variables for a call to EXPLAIN PLAN, whether called from SQL*Plus or another utility, are interpretted as VARCHAR2 (regardless of the actual bind variable data type) and are not initialized with a value (this also prevents bind variable peeking from affecting the execution plan). The Oracle Database documentation states the following about EXPLAIN PLAN: "Oracle does not support EXPLAIN PLAN for statements performing implicit type conversion of date bind variables. With bind variables in general, the EXPLAIN PLAN output might not represent the real execution plan."
Your article states that it is attempting to compare execution plans for NUMBER and CHAR binds, but the VC bind variable is actually defined as a VARCHAR2 and not a CHAR.
A quick demonstration:
CREATE TABLE T1 (C1 NUMBER, PRIMARY KEY(C1));
INSERT INTO T1
SELECT ROWNUM FROM DUAL CONNECT BY LEVEL<=100;
COMMIT;
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=>USER,TABNAME=>'T1',CASCADE=>TRUE)We now have a very simple table with a primary key index, and 100 rows in the table. On to the test:
VARIABLE N1 NUMBER
EXEC :N1:=1
ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT FOREVER, LEVEL 12';
SET AUTOTRACE ON
SELECT
C1
FROM
T1
WHERE
C1 = :N1;
Execution Plan
Plan hash value: 2546125981
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 3 | 0 (0)| 00:00:01 |
|* 1 | INDEX UNIQUE SCAN| SYS_C0028425 | 1 | 3 | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - access("C1"=TO_NUMBER(:N1))
SET AUTOTRACE OFFNotice the Predicate Information section of the execution plan shows that the N1 bind variable is being converted from a VARCHAR2 to a NUMBER for the comparison. That conversion is a direct result of AUTOTRACE using EXPLAIN PLAN to generate the excution plan for the SQL statement. Now, let's take a look at the way to display the actual execution plan (in Oracle Database 10.1 and greater):
SELECT
C1
FROM
T1
WHERE
C1 = :N1;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'TYPICAL'));
PLAN_TABLE_OUTPUT
SQL_ID d2fjtd39f9gmd, child number 0
SELECT C1 FROM T1 WHERE C1 = :N1
Plan hash value: 2546125981
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | | | 1 (100)|
|* 1 | INDEX UNIQUE SCAN| SYS_C0028425 | 1 | 3 | 0 (0)|
Predicate Information (identified by operation id):
1 - access("C1"=:N1)Notice in the above, the Predicate Information section does not show that the N1 bind variable is being converted from a VARCHAR2 to a NUMBER for the comparison.
Now that we are finished with the 10046 trace, we should disable it:
ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT OFF';Still not sure that SQL*Plus just calls EXPLAIN PLAN when AUTOTRACE is enabled? Take a look in the 10046 trace file that was generated, below is a small portion of the trace file:
PARSING IN CURSOR #11 len=85 dep=0 uid=286 oct=3 lid=286 tim=178896871268 hv=3595065010 ad='4697a6750' sqlid='gkgsxamb4hppk'
EXPLAIN PLAN SET STATEMENT_ID='PLUS702067' FOR SELECT
C1
FROM
T1
WHERE
C1 = :N1
END OF STMT
PARSE #11:c=0,e=144,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,plh=0,tim=178896871268
BINDS #11:
Bind#0
oacdty=01 mxl=32(00) mxlc=00 mal=00 scl=00 pre=00
oacflg=00 fl2=1010000 frm=01 csi=178 siz=32 off=0
kxsbbbfp=1f533240 bln=32 avl=00 flg=05Notice in the above the call to EXPLAIN PLAN, that the oacdty is set to 01 (VARCHAR2), and that the bind variable's value was not submitted.
Of course, it is also possible for TKPROF to show the wrong (Row Source Operation) execution plan for a query, but that is a topic for another discussion.
If anyone cares to see a case where the Row Source Operation execution plan may be displayed incorrectly, you will find a test case here:
http://hoopercharles.wordpress.com/2010/01/11/explain-plan-lies-autotrace-lies-tkprof-lies-what-is-the-plan/
Charles Hooper
Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
http://hoopercharles.wordpress.com/
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc. -
Unable to get the execution plan when using dbms_sqltune (11gR2)
Hi,
Database version: 11gR2
I have a user A that is granted privileges to execute dbms_sqltune.
I can create a task, excute it and run the report.
But, when I run the report I get the following error:
SQL> show user
USER is "A"
SQL> set long 10000 longchunksize 10000 linesize 200 pagesize 000
select dbms_sqltune.report_tuning_task(task_name => 'MYTEST') from dual;SQL>
GENERAL INFORMATION SECTION
Tuning Task Name : MYTEST
Tuning Task Owner : A
Workload Type : Single SQL Statement
Scope : COMPREHENSIVE
Time Limit(seconds): 1800
Completion Status : COMPLETED
Started at : 05/15/2013 11:53:22
Completed at : 05/15/2013 11:53:23
Schema Name: SYSMAN
SQL ID : gjm43un5cy843
SQL Text : SELECT SUM(USED), SUM(TOTAL) FROM (SELECT /*+ ORDERED */
SUM(D.BYTES)/(1024*1024)-MAX(S.BYTES) USED,
SUM(D.BYTES)/(1024*1024) TOTAL FROM (SELECT TABLESPACE_NAME,
SUM(BYTES)/(1024*1024) BYTES FROM (SELECT /*+ ORDERED USE_NL(obj
tab) */ DISTINCT TS.NAME FROM SYS.OBJ$ OBJ, SYS.TAB$ TAB,
SYS.TS$ TS WHERE OBJ.OWNER# = USERENV('SCHEMAID') AND OBJ.OBJ# =
TAB.OBJ# AND TAB.TS# = TS.TS# AND BITAND(TAB.PROPERTY,1) = 0 AND
BITAND(TAB.PROPERTY,4194400) = 0) TN, DBA_FREE_SPACE SP WHERE
SP.TABLESPACE_NAME = TN.NAME GROUP BY SP.TABLESPACE_NAME) S,
DBA_DATA_FILES D WHERE D.TABLESPACE_NAME = S.TABLESPACE_NAME
GROUP BY D.TABLESPACE_NAME)
ERRORS SECTION
- ORA-00942: table or view does not exist
SQL>
It seems there a missing privileg for dislaying the execution plan.
As a workaround, this is solved by granting select any dictionay (which I don't want) to the user A.
Does someone have an idea about what privilege is missing?
Kind Regards.Hi,
SELECT ANY DICTIONARY system privilege provides access to SYS schema objects only => which you are using as workaround
SELECT_CATALOG_ROLE provides access to all SYS views only.==> Safe option
SQL> grant SELECT ANY DICTIONARY to test;
Grant succeeded.
SQL> conn test/test
Connected.
SQL> select count(*) from sys.obj$;
COUNT(*)
13284
SQL> conn /as sysdba
Connected.
SQL> revoke SELECT ANY DICTIONARY from test;
Revoke succeeded.
SQL> grant SELECT_CATALOG_ROLE to test;
Grant succeeded.
SQL> conn test/test
Connected.
SQL> select count(*) from sys.obj$;
select count(*) from sys.obj$
ERROR at line 1:
ORA-00942: table or view does not existHTH -
When I excute rsplan ,but the application is not displayed correctly why?
when I excute rsplan ,but the application is not displayed correctly in our explore ,who can tell me what reason? 3ks very much
Hi,
please take a look at the following note:
919850 Problems with the planning modeler and the planning wizzard
Hope this helps ...
Matthias Nutt
SAP Consulting Switzerland
thanks Matthias Nutt 's reply
thanks very much
throuht you answer I have kown some about this ,and now I can modling throuht URL,but still can not start rsplan in gui ,whether I must to configuration a web service ,and that you can give me something about how to step to step configuration that,
thanks again -
Individual depreciation per particular asset per month-posted&planned
Hi experts,
how to run depreciation per particular asset and particular month either posted or planned.please help me.
Regards,
viswanadh.Hi ,
If you Want to Run the deprecation for a single Asset and also if you want to run for a perticular Period ,Follow this Process - in AFAB in Parameters you give fiscal Year and give the Period for which month you want to Run the deprecation and under reason of posting Select unPlanned Posting run , after this come down to Parameters to test run- give the Main asset Number i.e Asset Number for which you want to run Deprecation, first run in test mode then remove it and excute.
in the above process do not select any thing else.
with the above process you can run the Dep. for single Asset and month.
hope the above fullfills your requirment.
Thanks
Goutam -
Planning function reads data incorrectly
Hi,
I executed the planning function for the first time and then I deleted the data from the cube which got saved in the cube by the execution of the planning function and then I tried to execute the planning function for the second time but the planning function stills reads the previous values which resulted from the execution of the first planning function.
Could some oen tell me what is the problem,is the data stored in the buffer and the way to delete it.
Thanks,
SubhaHello,
After executing the delete planning function, explicity save the data. Pls check in LISTCUBE, whether the data is deleted successfully or not.
The goahead and excute the planning function second time..
Regards,
Ravi -
CWBQM to remove MIC from Inspection plan
We have requirement to remove few MIC from multiple inspection plan. SO I wanted to use CWBQM trx for that purpose.
We maintain inspection plan with unique id of group and gp counter.
Group 111 Counter 1
Gp 111 Countr 2
.Group 111 Counter 110 and many more.
Q-1: From abouve list I don't want to update all inspection plan. I want to update for only few counter of each group. So how to enter these group and group counter combination in initial screen to do mass change.
Q-2: We wanted to remove MIC1, MIC2, MIC5 from all inspection plan. Where to enter these MICs in intial screen so system pull only those MIC list of insp plan? these are complete copy model MIC.
Q-3: As said earlier we wanted to remove MIC from inspection plan. Now after excuting CWBQM we are getting list of MIC. So do mass change I'm selecting MIC column and applicable row and clicking on Extra --> mass change. Then system is not giving me MIC in pop-up list. It gives me all other data including qnt and qualitative field of MIC, but we wanted to remove complete MIC from plan. how to do that?
Please help.
Edited by: Tom_Eric on Apr 15, 2011 5:39 AMI'm following these steps:
CWBQM work area - Q_OPR_000000000010
Entering inspection plan data in selection screen - Ctrl + F7
Got MIC list
Select Master Inspection chara. column
Select row to delete particular MIC
Menu > Extra > Mass change --> Here I got two pop-up screen
One with name Mass change inspection char -- but this screen is empty - no field on this screen
There is one more screen which says "select fields" - List of fields like, lower limit, upper limit, catalog type, selected set, info feild, inspection method, plan, insp qualification, long term indicator, item......but there is no field which says MIC
If I select any field from second pop-up then it pull that field to mass change screen, but that I don't want to do. My purpose to remove MIC, not its field.
Please let me know where I am wrong? -
Conversion of planned orders to prod orders in background
hi All
Is there any program for mass conversion of planned orders in production orders which we can schedule in background.
AmitHi Amit,
Try below method
TCode: COHV (tab selection --- plant and etc...,, tab mass processing --- function - conveted planned order, order type - PP01, collective orders - do not collective orders)
after Menu -- Program --- Excute in background -- set properties -- to set send SAP spooler --- click button immediate then check box periodic job and periodic values after save
to monitor and get spool request bcackground this job
TCode SM37
or
you can create background job using TCode SM36
pls create varient for COHV
PRG: PPIO_ENTRY with Varient
Regards,
Sankaran
Maybe you are looking for
-
Finder in column view has no expander divider on the last column
I deal with a lot of graphics on my computer and I have a lot of subfolders. While in finder in column view there is no expanding divider for the last column when it is showing a graphic. When I first open a photo or graphic in finder the last column
-
I'm experiencing something similar, though it's with all multi-processing. I've tried exporting with both Quicktime (ProRes, Animation, etc) and with image sequences. No dice either way. I get an error dialog: Rendering Error: An Output module failed
-
I cannot preview the iBooks I am creating on my MacBook because my iPad is "supervised" by my employer's computer. Is there any way around this?
-
Hi, i am not getting the required any info from help.sap.com for Project system module...can you please share any docs if you have? Thanks & Regards, Vijaya
-
My Zen V Plus has totally crashe
I need help majorly. This morning my Zen crashed, but I managed to reset it after an hour or so :| ... Then before, I took it from the computer (it needed recharging as the freezing caused it to lose alot of it's power) but when I tried to turn it on