Newbie. SELECT with Clause: bad execution plan.
Hello
1)
SQL> WITH CTATEL AS 2 (SELECT A.CTA_FACTURAC, A.NUM_TELEFONO 3 FROM PFA_CONTABON A, PGA_CTAFACTU B, PGA_ABONOS C 4 WHERE B.CTA_FACTURAC=A.CTA_FACTURAC 5 AND C.NUM_TELEFONO=A.NUM_TELEFONO) 6 SELECT 71, A.CTA_FACTURAC, B.NUM_TELEFONO, A.COD_CONFACTU, SYSDATE, 0, A.TOT_IMPORTE*166.386, A.TOT_IMPORTE, 'E' 7 FROM SOL_FICHERO a, CTATEL b 8 WHERE ID_SOLICITUD=71 9 AND A.CTA_FACTURAC=B.CTA_FACTURAC 10 AND (A.NUM_TELEFONO IS NULL OR (A.NUM_TELEFONO <> '0' AND B.NUM_TELEFONO IS NOT NULL AND A.NUM_TELEFONO=B.NUM_TELEFONO)) 11 AND A.COD_CONFACTU IS NOT NULL AND EXISTS (SELECT 1 FROM PGSM_CONFACTU WHERE COD_CONFACTU=A.COD_CONFACTU); Execution Plan ---------------------------------------------------------- Plan hash value: 711563975 --------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 64 | 6 (0)| 00:00:01 | | 1 | NESTED LOOPS | | 1 | 64 | 6 (0)| 00:00:01 | | 2 | NESTED LOOPS | | 1 | 54 | 5 (0)| 00:00:01 | | 3 | NESTED LOOPS | | 1 | 45 | 4 (0)| 00:00:01 | | 4 | NESTED LOOPS SEMI | | 1 | 26 | 2 (0)| 00:00:01 | |* 5 | TABLE ACCESS BY INDEX ROWID| SOL_FICHERO | 2 | 44 | 2 (0)| 00:00:01 | |* 6 | INDEX RANGE SCAN | SOL_FICHERO_I01 | 6 | | 1 (0)| 00:00:01 | |* 7 | INDEX UNIQUE SCAN | PK_CONFACTU | 5820 | 23280 | 0 (0)| 00:00:01 | |* 8 | INDEX RANGE SCAN | PK_CONTABON | 1 | 19 | 2 (0)| 00:00:01 | |* 9 | INDEX UNIQUE SCAN | PK_CTAFACTU | 1 | 9 | 1 (0)| 00:00:01 | |* 10 | INDEX UNIQUE SCAN | PK_ABONOS | 1 | 10 | 1 (0)| 00:00:01 | --------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 5 - filter("A"."COD_CONFACTU" IS NOT NULL) 6 - access("ID_SOLICITUD"=71) 7 - access("COD_CONFACTU"="A"."COD_CONFACTU") 8 - access("A"."CTA_FACTURAC"="A"."CTA_FACTURAC") filter("A"."NUM_TELEFONO" IS NULL OR "A"."NUM_TELEFONO"="A"."NUM_TELEFONO" AND "A"."NUM_TELEFONO"<>'0') 9 - access("B"."CTA_FACTURAC"="A"."CTA_FACTURAC") 10 - access("C"."NUM_TELEFONO"="A"."NUM_TELEFONO")
2)
SQL> WITH CTATEL AS 2 (SELECT A.CTA_FACTURAC, A.NUM_TELEFONO 3 FROM PFA_CONTABON A, PGA_CTAFACTU B, PGA_ABONOS C 4 WHERE B.CTA_FACTURAC=A.CTA_FACTURAC 5 AND C.NUM_TELEFONO=A.NUM_TELEFONO) 6 SELECT 71, A.CTA_FACTURAC, NULL, A.COD_CONFACTU, SYSDATE, 0, A.TOT_IMPORTE*166.386, A.TOT_IMPORTE, 'E' 7 FROM SOL_FICHERO a 8 WHERE ID_SOLICITUD=71 9 AND A.NUM_TELEFONO IS NOT NULL AND A.NUM_TELEFONO='0' 10 AND EXISTS (SELECT 1 FROM CTATEL b WHERE A.CTA_FACTURAC=B.CTA_FACTURAC) 11 AND A.COD_CONFACTU IS NOT NULL AND EXISTS (SELECT 1 FROM PGSM_CONFACTU WHERE COD_CONFACTU=A.COD_CONFACTU); Execution Plan ---------------------------------------------------------- Plan hash value: 3992598922 ------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 26 | 7 (0)| 00:00:01 | |* 1 | FILTER | | | | | | | 2 | NESTED LOOPS SEMI | | 1 | 26 | 2 (0)| 00:00:01 | |* 3 | TABLE ACCESS BY INDEX ROWID| SOL_FICHERO | 1 | 22 | 2 (0)| 00:00:01 | |* 4 | INDEX RANGE SCAN | SOL_FICHERO_I01 | 6 | | 1 (0)| 00:00:01 | |* 5 | INDEX UNIQUE SCAN | PK_CONFACTU | 5820 | 23280 | 0 (0)| 00:00:01 | | 6 | NESTED LOOPS | | 1 | 38 | 5 (0)| 00:00:01 | | 7 | NESTED LOOPS | | 1 | 28 | 4 (0)| 00:00:01 | |* 8 | INDEX UNIQUE SCAN | PK_CTAFACTU | 1 | 9 | 2 (0)| 00:00:01 | |* 9 | INDEX RANGE SCAN | PK_CONTABON | 1 | 19 | 2 (0)| 00:00:01 | |* 10 | INDEX UNIQUE SCAN | PK_ABONOS | 1 | 10 | 1 (0)| 00:00:01 | ------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter( EXISTS (SELECT /*+ */ 0 FROM "FACTMS"."PGA_ABONOS_1" "C","FACTMS"."PGA_CTAFACTU" "B","FACTMS"."PFA_CONTABON_1" "A" WHERE "B"."CTA_FACTURAC"="A"."CTA_FACTURAC" AND "A"."CTA_FACTURAC"=:B1 AND "B"."CTA_FACTURAC"=:B2 AND "C"."NUM_TELEFONO"="A"."NUM_TELEFONO")) 3 - filter("A"."COD_CONFACTU" IS NOT NULL AND "A"."NUM_TELEFONO" IS NOT NULL AND "A"."NUM_TELEFONO"='0') 4 - access("ID_SOLICITUD"=71) 5 - access("COD_CONFACTU"="A"."COD_CONFACTU") 8 - access("B"."CTA_FACTURAC"=:B1) 9 - access("B"."CTA_FACTURAC"="A"."CTA_FACTURAC") filter("A"."CTA_FACTURAC"=:B1) 10 - access("C"."NUM_TELEFONO"="A"."NUM_TELEFONO")
3)
1 WITH CTATEL AS 2 (SELECT A.CTA_FACTURAC, A.NUM_TELEFONO 3 FROM PFA_CONTABON A, PGA_CTAFACTU B, PGA_ABONOS C 4 WHERE B.CTA_FACTURAC=A.CTA_FACTURAC 5 AND C.NUM_TELEFONO=A.NUM_TELEFONO) 6 SELECT 71, A.CTA_FACTURAC, B.NUM_TELEFONO, A.COD_CONFACTU, SYSDATE, 0, A.TOT_IMPORTE*166.386, A.TOT_IMPORTE, 'E' 7 FROM SOL_FICHERO a, CTATEL b 8 WHERE ID_SOLICITUD=71 9 AND A.CTA_FACTURAC=B.CTA_FACTURAC 10 AND (A.NUM_TELEFONO IS NULL OR (A.NUM_TELEFONO <> '0' AND B.NUM_TELEFONO IS NOT NULL AND A.NUM_TELEFONO=B.NUM_TELEFONO)) 11 AND A.COD_CONFACTU IS NOT NULL AND EXISTS (SELECT 1 FROM PGSM_CONFACTU WHERE COD_CONFACTU=A.COD_CONFACTU) 12 UNION ALL 13 SELECT 71, A.CTA_FACTURAC, NULL, A.COD_CONFACTU, SYSDATE, 0, A.TOT_IMPORTE*166.386, A.TOT_IMPORTE, 'E' 14 FROM SOL_FICHERO a 15 WHERE ID_SOLICITUD=71 16 AND A.NUM_TELEFONO IS NOT NULL AND A.NUM_TELEFONO='0' 17 AND EXISTS (SELECT 1 FROM CTATEL b WHERE A.CTA_FACTURAC=B.CTA_FACTURAC) 18* AND A.COD_CONFACTU IS NOT NULL AND EXISTS (SELECT 1 FROM PGSM_CONFACTU WHERE COD_CONFACTU=A.COD_CONFACTU) Execution Plan ---------------------------------------------------------- Plan hash value: 3945970136 ----------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ----------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 3351 | 127K| | 776 (53)| 00:00:10 | | 1 | TEMP TABLE TRANSFORMATION | | | | | | | | 2 | LOAD AS SELECT | | | | | | | |* 3 | HASH JOIN | | 323K| 11M| 12M| 66832 (4)| 00:13:22 | |* 4 | HASH JOIN | | 338K| 9254K| 4176K| 39353 (3)| 00:07:53 | | 5 | INDEX FAST FULL SCAN | PK_CTAFACTU | 203K| 1788K| | 190 (4)| 00:00:03 | | 6 | INDEX FAST FULL SCAN | PK_CONTABON | 16M| 300M| | 13975 (4)| 00:02:48 | | 7 | INDEX FAST FULL SCAN | PK_ABONOS | 15M| 150M| | 9766 (5)| 00:01:58 | | 8 | UNION-ALL | | | | | | | |* 9 | HASH JOIN | | 3350 | 127K| | 388 (5)| 00:00:05 | | 10 | NESTED LOOPS SEMI | | 1 | 26 | | 2 (0)| 00:00:01 | |* 11 | TABLE ACCESS BY INDEX ROWID| SOL_FICHERO | 2 | 44 | | 2 (0)| 00:00:01 | |* 12 | INDEX RANGE SCAN | SOL_FICHERO_I01 | 6 | | | 1 (0)| 00:00:01 | |* 13 | INDEX UNIQUE SCAN | PK_CONFACTU | 5820 | 23280 | | 0 (0)| 00:00:01 | | 14 | VIEW | | 323K| 4112K| | 379 (4)| 00:00:05 | | 15 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6621_1BE166BB | 323K| 6009K| | 379 (4)| 00:00:05 | |* 16 | HASH JOIN SEMI | | 1 | 33 | | 388 (5)| 00:00:05 | | 17 | NESTED LOOPS SEMI | | 1 | 26 | | 2 (0)| 00:00:01 | |* 18 | TABLE ACCESS BY INDEX ROWID| SOL_FICHERO | 1 | 22 | | 2 (0)| 00:00:01 | |* 19 | INDEX RANGE SCAN | SOL_FICHERO_I01 | 6 | | | 1 (0)| 00:00:01 | |* 20 | INDEX UNIQUE SCAN | PK_CONFACTU | 5820 | 23280 | | 0 (0)| 00:00:01 | | 21 | VIEW | | 323K| 2214K| | 379 (4)| 00:00:05 | | 22 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6621_1BE166BB | 323K| 6009K| | 379 (4)| 00:00:05 | ----------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("C"."NUM_TELEFONO"="A"."NUM_TELEFONO") 4 - access("B"."CTA_FACTURAC"="A"."CTA_FACTURAC") 9 - access("A"."CTA_FACTURAC"="B"."CTA_FACTURAC") filter("A"."NUM_TELEFONO" IS NULL OR "A"."NUM_TELEFONO"="B"."NUM_TELEFONO" AND "A"."NUM_TELEFONO"<>'0') 11 - filter("A"."COD_CONFACTU" IS NOT NULL) 12 - access("ID_SOLICITUD"=71) 13 - access("COD_CONFACTU"="A"."COD_CONFACTU") 16 - access("A"."CTA_FACTURAC"="B"."CTA_FACTURAC") 18 - filter("A"."COD_CONFACTU" IS NOT NULL AND "A"."NUM_TELEFONO" IS NOT NULL AND "A"."NUM_TELEFONO"='0') 19 - access("ID_SOLICITUD"=71) 20 - access("COD_CONFACTU"="A"."COD_CONFACTU")
I use this WITH clausule in the query above:
operating system
WITH CTATEL AS (SELECT A.CTA_FACTURAC, A.NUM_TELEFONO FROM PFA_CONTABON A, PGA_CTAFACTU B, PGA_ABONOS C WHERE B.CTA_FACTURAC=A.CTA_FACTURAC AND C.NUM_TELEFONO=A.NUM_TELEFONO)
Why 3) plan is so bad? (In any case, it's like "UNION ALL" of 1) and 2).
Thanks in advance,
Jose Luis
We do not know if one of them is 'bad' plans.
In fact, there is no such thing as a bad plan, one or several inaccurate estimates.
To determine whether a plan is 'bad', you really see who believes are inaccurate - and which means the time of execution of the execution plans and runtime enforcement measures.
Please take a look at the notice in the following thread:
HOW to: Validate a query of SQL statement tuning - model showing
What happens in the third SQL, is that because you referenced the subquery WITH twice, Oracle decides to materialise it in a temporary table for the reason that it is cheaper that to do the same thing one subquery normally twice - a reasonable approach.
It is probably more likely that the third query estimates are more accurate than the other two.
Tags: Database
Similar Questions
-
Hello
I do not understand why this sql has a bad execution plan?
SELECT DISTINCT LETTER0_. LE_IDENT AS col_0_0_
THE LETTER LETTER0_
LEFT OUTER JOIN CONTEXT1_ CONTEXT
ON LETTER0_. LE_PTRCTXID = CONTEXT1_. CTX_IDENT
LEFT OUTER JOIN F_DOC f_doc2_
ON LETTER0_. LE_PTRDOCID = f_doc2_. DOC_IDENT
WHERE LETTER0_. LE_IDENT IN
(SELECT LETTER3_. LE_IDENT
THE LETTER LETTER3_, CONTEXT CONTEXT4_
WHERE LETTER3_. LE_PTRCTXID = CONTEXT4_. CTX_IDENT
AND CONTEXT4_. CTX_PTRPOLID = 400728434)
OR LETTER0_. LE_IDENT IN (2525432);
Execution plan
----------------------------------------------------------
0 SELECT optimizer Mode STATEMENT = ALL_ROWS (cost = card 175 = 14 K bytes = 83 K)
1 FILTER 0
2 1 INDEX FULL SCAN PROSHIVA1. PK_LE_CLE (cost = card 175 = 284 K bytes = 1 M)
3 1 LOOPS IMBRIQUEES (cost = 4 cards = 1 bytes = 22)
TABLE 3 ACCESS BY INDEX ROWID PROSHIVA1 4. F_LETTRES (cost = 2 card = 1 bytes = 13)
5 4 INDEX UNIQUE PROSHIVA1 SCAN. PK_LE_CLE (cost = 1 card = 1)
6 TABLE ACCESS BY INDEX ROWID PROSHIVA1 3. F_CONTEXT (cost = 2 card = 1 bytes = 9)
7 6 INDEX RANGE SCAN PROSHIVA1. IND_CTX_PTRPOLID (cost = 1 card = 1)
Statistics
----------------------------------------------------------
5 user calls
0 physical total bytes read
physical write 0 total bytes
0 3 spare statistics
0 commit failures of drain plug: can not pin
Extension of TBS 0: extended bytes
0 total number of times SMON post
SMON 0 posted for undo segment recovery
SMON 0 posted to drop the temp segment
prealloc segment 0 tasks
1 rows processed
9f9cf8b7-e5bc-4AAF-B369-b189dadb9d77 wrote:
Thanks for the reply
due to the second line of the execution plan. INDEX FULL SCAN PROSHIVA1. PK_LE_CLE (cost = card 175 = 284 K bytes = 1 M).
This sql takes 2 seconds. and if I remove any OF the sql condition. There are only 200 ms.
This is a typical problem optimizer - IN / associate EXISTS OR does work well in many cases. Most likely, if you simply specify the IN clause, the optimizer will unnest subquery, which could be much faster in this case.
Furthermore, the optimizer has already done a good job in eliminating unnecessary outer joins, there is no mention of CONTEXT or F_DOC in the source line of the FILTER operator. He even eliminated the SEPARATE, most likely because he knows that LETTER. LE_IDENT is unique.
Think of what the database has to do with your request - need to find matches which have the mentioned ID or who have a match in the specified list as subquery. So without more clever query processing, it must pass the primary key index set and check, for each line, if it is a match in the IN subquery - that's exactly what makes the FILTER operator, it executes the LOOP IMBRIQUEE join that represents the IN clause for each row returned by the full index scan.
Ideally, this should be transformed by using a transformation of CONCATENATION, where this query is actually split in two: part of the research for the mentioned ID and the other party responsible for looking for matches with subqueries and this making, ensuring that the two branches do not result in duplicate (since a line could satisfy both conditions).
You can try an explicit indication of USE_CONCAT for the query, but I doubt that the optimizer will do it automatically.
So if it does not, you could do the same thing as a manual rewrite:
SELECT LETTER0_. LE_IDENT AS col_0_0_
THE LETTER LETTER0_
WHERE LETTER0_. LE_IDENT = 2525432
UNION ALL
SELECT LETTER0_. LE_IDENT AS col_0_0_
THE LETTER LETTER0_
WHERE LETTER0_. LE_IDENT IN
(SELECT LETTER3_. LE_IDENT
THE LETTER LETTER3_, CONTEXT CONTEXT4_
WHERE LETTER3_. LE_PTRCTXID = CONTEXT4_. CTX_IDENT
AND CONTEXT4_. CTX_PTRPOLID = 400728434)
AND LNNVL (LETTER0_. LE_IDENT = 2525432);
The LNNVL is the bit that filter potential duplicates and which would be automatically generated by the transformation of the CONCATENATION.
Randolf
-
How to clear failed execution Plans?
Hello world
This should be an easy thing, but I can't seem to find a way to do it.
I created a custom implementation plan and added each financial area in the plan. Then I generated settings, you click on build and then he ran. Failed to run.
I noticed that there is a pre-configured with "R12 Financials_Oracle" execution plan and decided that I wanted to really run was Financials_Oracle R12 and not my personal plan. So I clicked on build for R12 Financials_Oracle plan of execution, and once it is finished, I clicked 'Run Now'. When you click Run now he told me that my custom implementation plan was completed with a failed State and until she is done correctly, no other plan could be run. I really don't want my custom plan completes successfully. I want to run the other plan instead.
How to remove/delete on my failure run data so I can start a new execution plan?
Thanks for the help!
-JoeIn DACS under the window RUN, do the following:
-Go to the tab "Run in progress".
-Highlight the execution plan has failed.
-Click right and selected 'Brand.' as completed
-Enter the number/text in the box.Then:
-In the toolbar at the top of the page, select--> management ETL tools--> reset Data Sources
-Enter the number/text in the boox.Now you are ready to start the new execution plan.
I hope this helps.
-Austin
-
Need help to get the actual execution plan
I need to get the actual execution plan of a query and its actual cost.
If I understand correctly explaining the plan gives only the estimated according to my plan. Can someone help me please?I'm doing this:
SQL> select OBJECT_NAME,DATA_OBJECT_ID,STATUS from dba_objects where owner='SANTU'; OBJECT_NAME DATA_OBJECT_ID STATUS -------------------------------------------------------------------------------- ------------------------------------------------ -------------- ------- TST_REDEF 73444 VALID REDEF_PK 73447 VALID SQL> select sql_id,sql_text from v$sqlarea where sql_text like '%DATA_OBJECT_ID,STATUS from dba_objects%'; SQL_ID ------------- SQL_TEXT -------------------------------------------------------------------------------- gbvnfhs59t98f select sql_id,sql_text from v$sqlarea where sql_text like '%DATA_OBJECT_ID,STATUS from dba_objects%' bxdyf6ph2g3ay select OBJECT_NAME,DATA_OBJECT_ID,STATUS from dba_objects where owner='SANTU' SQL> select * from table(dbms_xplan.display_cursor('bxdyf6ph2g3ay')); PLAN_TABLE_OUTPUT -------------------------------------------------------------------------------- SQL_ID bxdyf6ph2g3ay, child number 0 ------------------------------------- select OBJECT_NAME,DATA_OBJECT_ID,STATUS from dba_objects where owner='SANTU' Plan hash value: 2160718650 ------------------------------------------------------------------------------------------------ | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------ | 0 | SELECT STATEMENT | | | | 47 (100)| | | 1 | VIEW | DBA_OBJECTS | 1638 | 161K| 47 (3)| 00:00:01 | | 2 | UNION-ALL | | | | | | |* 3 | FILTER | | | | | | |* 4 | HASH JOIN | | 1830 | 209K| 46 (3)| 00:00:01 | | 5 | INDEX FULL SCAN | I_USER2 | 88 | 1936 | 1 (0)| 00:00:01 | | 6 | NESTED LOOPS | | 1830 | 169K| 45 (3)| 00:00:01 | | 7 | TABLE ACCESS BY INDEX ROWID| USER$ | 1 | 18 | 1 (0)| 00:00:01 | |* 8 | INDEX UNIQUE SCAN | I_USER1 | 1 | | 0 (0)| | |* 9 | TABLE ACCESS FULL | OBJ$ | 1830 | 137K| 44 (3)| 00:00:01 | |* 10 | TABLE ACCESS BY INDEX ROWID | IND$ | 1 | 8 | 2 (0)| 00:00:01 | |* 11 | INDEX UNIQUE SCAN | I_IND1 | 1 | | 1 (0)| 00:00:01 | | 12 | NESTED LOOPS | | 1 | 29 | 2 (0)| 00:00:01 | |* 13 | INDEX FULL SCAN | I_USER2 | 1 | 20 | 1 (0)| 00:00:01 | |* 14 | INDEX RANGE SCAN | I_OBJ4 | 1 | 9 | 1 (0)| 00:00:01 | | 15 | NESTED LOOPS | | 1 | 97 | 1 (0)| 00:00:01 | | 16 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 18 | 1 (0)| 00:00:01 | |* 17 | INDEX UNIQUE SCAN | I_USER1 | 1 | | 0 (0)| | |* 18 | INDEX RANGE SCAN | I_LINK1 | 1 | 79 | 0 (0)| | ------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 3 - filter(((("O"."TYPE#"<>1 AND "O"."TYPE#"<>10) OR ("O"."TYPE#"=1 AND =1)) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND ((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR IS NOT NULL))))) 4 - access("O"."OWNER#"="U"."USER#") 8 - access("U"."NAME"='SANTU') 9 - filter(("O"."NAME"<>'_NEXT_OBJECT' AND "O"."NAME"<>'_default_auditing_opt ions_' AND "O"."LINKNAME" IS NULL AND BITAND("O"."FLAGS",128)=0 AND "O"." SPARE3"="U"."USER#")) 10 - filter(("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9)) 11 - access("I"."OBJ#"=:B1) 13 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv',' current_ edition_id'))) filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv', 'current _edition_id')))) 14 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."US ER#") 17 - access("U"."NAME"='SANTU') 18 - access("L"."OWNER#"="U"."USER#") 57 rows selected. SQL>
Kind regards
S.K. -
Execution plan failed with no task has failed
Hi all
I'm OBIEE11g - BIapps 7.9.6.3 - Informatica 9 environment.
I had the execution plan of the status failed with no details of the task in this status. All tasks are completed or stopped status and I am unable to find the problem.
Here is the log of the ETL:
++ 67 SEVERE Thu Sep 13 17:48:31 CEST 2012 ++
++--------------------------------------------++
++ ETL START ++
++--------------------------------------------++
++ 68 SEVERE game + Sep 13 17:48:59 CEST 2012 from ETL process. +
+ 69 SEVERE Thu Sep 13 17:49:04 CEST 2012 +.
FAULT INFO: Could NOT WRITE TO THE OUTPUT LOG FILE: IT IS LOCKED /BIapps/home/obi/app/obi/product/11.2.0/client_1/bifoundation/dac//log/SIL_InsertRowInRunTable_SESSIONS.log
MESSAGE:::/BIapps/home/Obi/app/Obi/product/11.2.0/Client_1/bifoundation/DAC/log/SIL_InsertRowInRunTable_SESSIONS.log (Permission denied)
EXCEPTION CLASS: java.io.FileNotFoundException
java.io.FileOutputStream.open (Native Method)
java.io.FileOutputStream. < init > (FileOutputStream.java:179)
java.io.FileOutputStream. < init > (FileOutputStream.java:70)
com.siebel.etl.functional.ExternalProcessExecutor.waitFor(ExternalProcessExecutor.java:249)
com.siebel.etl.functional.ExternalProcessExecutor.fire(ExternalProcessExecutor.java:144)
com.siebel.etl.functional.ExternalProcessExecutor.execute(ExternalProcessExecutor.java:121)
com.siebel.etl.engine.core.AttachToInformaticaProcess.getSessionInformation(AttachToInformaticaProcess.java:427)
com.siebel.etl.engine.core.AttachToInformaticaProcess.getSessionsSet(AttachToInformaticaProcess.java:753)
com.siebel.etl.engine.core.AttachToInformaticaProcess.prepareLocalParameterFile(AttachToInformaticaProcess.java:776)
com.siebel.etl.engine.core.AttachToInformaticaProcess.executeWorkFlow(AttachToInformaticaProcess.java:499)
com.siebel.analytics.etl.etltask.InformaticaTask.doExecute(InformaticaTask.java:159)
com.siebel.analytics.etl.etltask.GenericTaskImpl.doExecuteWithRetries(GenericTaskImpl.java:410)
com.siebel.analytics.etl.etltask.GenericTaskImpl.execute(GenericTaskImpl.java:306)
com.siebel.analytics.etl.etltask.GenericTaskImpl.execute(GenericTaskImpl.java:213)
com.siebel.analytics.etl.etltask.GenericTaskImpl.run(GenericTaskImpl.java:585)
com.siebel.analytics.etl.taskmanager.XCallable.call(XCallable.java:63)
java.util.concurrent.FutureTask$ Sync.innerRun (FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.Executors$ RunnableAdapter.call (Executors.java:441)
java.util.concurrent.FutureTask$ Sync.innerRun (FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ThreadPoolExecutor$ Worker.runTask (ThreadPoolExecutor.java:885)
java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:907)
java.lang.Thread.run(Thread.java:619)
+ 70 SEVERE Thu Sep 13 17:49:04 CEST 2012 in WRITING to: /BIapps/home/obi/app/obi/product/11.2.0/client_1/bifoundation/dac//log/SIL_InsertRowInRunTable_SESSIONS.log_1+
+ 71 SEVERE Thu Sep 13 17:49:04 CEST 2012 file output stream is null. +
filenameORA_R1213_Flatfile.DataWarehouse.SILOS.SIL_InsertRowInRunTable.txt dir
Content of +/BIapps/Informatica/9.0.1/Server/infa_shared/SrcFiles +.
+ [SILOS. SIL_InsertRowInRunTable] +.
+ $$ ANALYSIS_END = 12:59:00 + 01/01/2011
+ $$ ANALYSIS_END_WID = 20110101 +.
+ $$ ANALYSIS_START = 01:00:00 + 31/12/1979
+ $$ ANALYSIS_START_WID = 19791231 +.
+ $$ COST_TIME_GRAIN = QUARTER +.
+ $$ CURRENT_DATE = 09/13/2012 +.
It's confusing because it is said that the SIL_InsertRowInRunTable_SESSIONS.log_1 file could not be written, but it is updated at the same time plan exec with no error message.
Please send any suggestions,
Thank you allCan you confirm that the DAC user has read/write access to the directory of the log file (/ BIapps/home/obi/app/obi/product/11.2.0/client_1/bifoundation/dac/log/SIL_InsertRowInRunTable_SESSIONS.log)? This is on Linux? Can you try to do a CHMOD-r 777 on the parent directory if the user OS DAC does not have access?
So useful, mark it as good or useful.
-
With concatenation execution plan
Hi all
Could someone help to find out why concatenation is used by the optimizer and how I avoid it.
Oracle Version: 10.2.0.4
table of IFE.entityids were brought - partitioned on the data_provider column.select * from ( select distinct EntityType, EntityID, DateModified, DateCreated, IsDeleted from ife.EntityIDs i join (select orgid from equifaxnormalize.org_relationships where orgid is not null and related_orgid is not null and ((Date_Modified >= to_date('2011-06-12 14:00:00','yyyy-mm-dd hh24:mi:ss') and Date_Modified < to_date('2011-06-13 14:00:00','yyyy-mm-dd hh24:mi:ss')) OR (Date_Created >= to_date('2011-06-12 14:00:00','yyyy-mm-dd hh24:mi:ss') and Date_Created < to_date('2011-06-13 14:00:00','yyyy-mm-dd hh24:mi:ss')) ) ) r on(r.orgid= i.entityid) where EntityType = 1 and ((DateModified >= to_date('2011-06-12 14:00:00','yyyy-mm-dd hh24:mi:ss') and DateModified < to_date('2011-06-13 14:00:00','yyyy-mm-dd hh24:mi:ss')) OR (DateCreated >= to_date('2011-06-12 14:00:00','yyyy-mm-dd hh24:mi:ss') and DateCreated < to_date('2011-06-13 14:00:00','yyyy-mm-dd hh24:mi:ss')) ) and ( IsDeleted = 0) and IsDistributable = 1 and EntityID >= 0 order by EntityID --order by NLSSORT(EntityID,'NLS_SORT=BINARY') ) where rownum <= 10; Execution Plan ---------------------------------------------------------- Plan hash value: 227906424 ------------------------------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | ------------------------------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 10 | 570 | 39 (6)| 00:00:01 | | | |* 1 | COUNT STOPKEY | | | | | | | | | 2 | VIEW | | 56 | 3192 | 39 (6)| 00:00:01 | | | |* 3 | SORT ORDER BY STOPKEY | | 56 | 3416 | 39 (6)| 00:00:01 | | | | 4 | HASH UNIQUE | | 56 | 3416 | 38 (3)| 00:00:01 | | | | 5 | CONCATENATION | | | | | | | | |* 6 | TABLE ACCESS BY INDEX ROWID | ORG_RELATIONSHIPS | 1 | 29 | 1 (0)| 00:00:01 | | | | 7 | NESTED LOOPS | | 27 | 1647 | 17 (0)| 00:00:01 | | | | 8 | TABLE ACCESS BY GLOBAL INDEX ROWID| ENTITYIDS | 27 | 864 | 4 (0)| 00:00:01 | ROWID | ROWID | |* 9 | INDEX RANGE SCAN | UX_TYPE_MOD_DIST_DEL_ENTITYID | 27 | | 2 (0)| 00:00:01 | | | |* 10 | INDEX RANGE SCAN | IX_EFX_ORGRELATION_ORGID | 1 | | 1 (0)| 00:00:01 | | | |* 11 | TABLE ACCESS BY INDEX ROWID | ORG_RELATIONSHIPS | 1 | 29 | 1 (0)| 00:00:01 | | | | 12 | NESTED LOOPS | | 29 | 1769 | 20 (0)| 00:00:01 | | | | 13 | PARTITION RANGE ALL | | 29 | 928 | 5 (0)| 00:00:01 | 1 | 3 | |* 14 | TABLE ACCESS BY LOCAL INDEX ROWID| ENTITYIDS | 29 | 928 | 5 (0)| 00:00:01 | 1 | 3 | |* 15 | INDEX RANGE SCAN | IDX_ENTITYIDS_ETYPE_DC | 29 | | 4 (0)| 00:00:01 | 1 | 3 | |* 16 | INDEX RANGE SCAN | IX_EFX_ORGRELATION_ORGID | 1 | | 1 (0)| 00:00:01 | | | ------------------------------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter(ROWNUM<=10) 3 - filter(ROWNUM<=10) 6 - filter(("DATE_MODIFIED">=TO_DATE(' 2011-06-12 14:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "DATE_MODIFIED"<TO_DATE(' 2011-06-13 14:00:00', 'syyyy-mm-dd hh24:mi:ss') OR "DATE_CREATED">=TO_DATE(' 2011-06-12 14:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "DATE_CREATED"<TO_DATE(' 2011-06-13 14:00:00', 'syyyy-mm-dd hh24:mi:ss')) AND "RELATED_ORGID" IS NOT NULL) 9 - access("I"."ENTITYTYPE"=1 AND "I"."DATEMODIFIED">=TO_DATE(' 2011-06-12 14:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "I"."ISDISTRIBUTABLE"=1 AND "I"."ISDELETED"=0 AND "I"."ENTITYID">=0 AND "I"."DATEMODIFIED"<=TO_DATE(' 2011-06-13 14:00:00', 'syyyy-mm-dd hh24:mi:ss')) filter("I"."ISDISTRIBUTABLE"=1 AND "I"."ISDELETED"=0 AND "I"."ENTITYID">=0) 10 - access("ORGID"="I"."ENTITYID") filter("ORGID" IS NOT NULL AND "ORGID">=0) 11 - filter(("DATE_MODIFIED">=TO_DATE(' 2011-06-12 14:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "DATE_MODIFIED"<TO_DATE(' 2011-06-13 14:00:00', 'syyyy-mm-dd hh24:mi:ss') OR "DATE_CREATED">=TO_DATE(' 2011-06-12 14:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "DATE_CREATED"<TO_DATE(' 2011-06-13 14:00:00', 'syyyy-mm-dd hh24:mi:ss')) AND "RELATED_ORGID" IS NOT NULL) 14 - filter("I"."ISDISTRIBUTABLE"=1 AND "I"."ISDELETED"=0 AND (LNNVL("I"."DATEMODIFIED">=TO_DATE(' 2011-06-12 14:00:00', 'syyyy-mm-dd hh24:mi:ss')) OR LNNVL("I"."DATEMODIFIED"<=TO_DATE(' 2011-06-13 14:00:00', 'syyyy-mm-dd hh24:mi:ss'))) AND "I"."ENTITYID">=0) 15 - access("I"."ENTITYTYPE"=1 AND "I"."DATECREATED">=TO_DATE(' 2011-06-12 14:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "I"."DATECREATED"<=TO_DATE(' 2011-06-13 14:00:00', 'syyyy-mm-dd hh24:mi:ss')) 16 - access("ORGID"="I"."ENTITYID") filter("ORGID" IS NOT NULL AND "ORGID">=0)
Is there a better way to rewrite this sql OR is it possible to eliminate the concatenation?
Thank youAs general approach, see the tuning wires:
[url http://forums.oracle.com/forums/thread.jspa?threadID=863295] How to post a sql tuning request
[url http://forums.oracle.com/forums/thread.jspa?messageID=1812597] When your query takes too longThe approach is essentially, for where the estimates are more inaccurate compared to actual expenditures and can find the reasons why.
Most of the time, if the statistics are accurate and then the estimates are correct, you will have a good plan. -
bad result of 11 2 recursive with clause GR
This thread is a continuation of ORA-01790 11 GR 2 recursive with clause
select * from v$version; BANNER ------------------------------------------------------- Oracle Database 11g Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for 32-bit Windows: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production
Why the DAYC column is decreased?with rec(dayc,LV) as( select cast(date '2010-04-15' as date),1 from dual union all select cast(dayc+1 as date),LV+1 from rec where LV<= 3) select * from rec; DAYC LV -------- --------- 10-04-15 1 10-04-14 2 10-04-13 3 10-04-12 4
I think correct resultSet is less than
DAYC LV -------- --------- 10-04-15 1 10-04-16 2 10-04-17 3 10-04-18 4
Indeed, a complete mess with dates as recursive columns:
If you repeat the column somehow it seems to work again:
SQL> with rec(lv, dayc, dayc2) as ( select 1, cast(sysdate as date), null from dual union all select lv + 1, cast(dayc as date) + 1, dayc from rec where lv <= 3 ) -- -- select * from rec / LV DAYC DAYC2 ---------- ---------- ---------- 1 08.04.2010 2 09.04.2010 08.04.2680 3 10.04.2010 09.04.2680 4 11.04.2010 10.04.2680 4 rows selected.
but after playing with it a bit, I would certainly avoid using dates in the form of recursive columns (yet).
-
Should I wait until the end of the execution time of the query for the execution plan?
Hello Experts,
I want to see the execution plan of the query below. However, it takes more than 3 hours. Should I wait all the time to see the execution plan?
Note: EXPLAIN PLAN for does not work. (I mean that I do not see the actual line number, etc. with EXPLAIN the PLAN of market)
You can see the output of the execution plan when I canceled the execution after 1 minute.
My first question is: what should I do to see the execution plan for queries running out of time time?
2nd question: when I cancel the query during execution in order to see the execution plan, will I see the specific plan of execution or erroneous values? Because the first execution plan seems inaccurate, what do you think?
question 3: why EXPLAIN the PLAN for the clause does not work? Also, should I use EXPLAIN the PLAN of the clause to this scenerio? Can I see the result of running for long time without her queries?
Thnaks for your help.
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE Production 11.2.0.2.0
AMT for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * / J.INVOICEACCOUNT, J.INVOICEID, J.INVOICEDATE, (T.LINEAMOUNT + T.LINEAMOUNTTAX) price
of custinvoicejour j join custinvoicetrans t on
substr (nls_lower (j.DataAreaId), 1, 7) = substr (nls_lower (t.dataareaid), 1, 7) and
substr (nls_lower (J.INVOICEID), 1: 25) = substr (nls_lower (t.INVOICEID), 1: 25)
where
substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM = 29457
and substr (nls_lower (j.dataareaid), 1, 7) = '201' and
J.INVOICEACCOUNT in
(select IT. Drmpos.avtr_seg_cust_campend ACCOUNTNUM this where THIS. CAMPAIGN = '201406' and THIS. SEGMENT_LEVEL in (', 'E'))
and J.AVAWARDSALES > 190
and substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406'
"and J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 ';
SQL_ID, dznya6x7st0t8, number of children 0
-------------------------------------
Select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * / J.INVOICEACCOUNT,.
J.INVOICEID, J.INVOICEDATE, (T.LINEAMOUNT + T.LINEAMOUNTTAX) price of
CustInvoiceJour j join custinvoicetrans t on
substr (nls_lower (j.DataAreaId), 1, 7) =
substr (nls_lower (t.DataAreaId), 1, 7) and
= substr (nls_lower (J.INVOICEID), 1: 25)
substr (nls_lower (t.INVOICEID), 1: 25) where
substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM =
29457 and substr (nls_lower, (j.dataareaid), 1, 7) = '201' and
J.INVOICEACCOUNT in (select CE. ACCOUNTNUM of
drmpos.avtr_seg_cust_campend this where THIS. CAMPAIGN = '201406' and
IT. SEGMENT_LEVEL in (', 'E')) and J.AVAWARDSALES > 190 and
substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406' and
"J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 '.
Hash value of plan: 2002317666
--------------------------------------------------------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Begins | E - lines. A - lines. A - time | Pads | Bed | OMem | 1Mem | Used Mem.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1. | 0 | 00:00:00.01 | 0 | 0 | | | |
|* 1 | HASH JOIN | | 1. 3956. 0 | 00:00:00.01 | 0 | 0 | 2254K | 1061K | 2190K (0) |
|* 2 | HASH JOIN | | 1. 87. 16676. 00:00:01.64 | 227K | 3552. 3109K | 1106K | 4111K (0) |
|* 3 | TABLE ACCESS BY INDEX ROWID | CUSTINVOICEJOUR | 1. 1155 | 31889 | 00:00:01.16 | 223KO | 15. | | |
|* 4 | INDEX RANGE SCAN | I_062INVOICEDATEORDERTYPEIDX | 1. 4943 | 134K | 00:00:00.83 | 45440 | 0 | | | |
| 5. SIMPLE LIST OF PARTITION. | 1. 82360 | 173K | 00:00:00.08 | 3809 | 3537 | | | |
|* 6 | TABLE ACCESS FULL | AVTR_SEG_CUST_CAMPEND | 1. 82360 | 173K | 00:00:00.06 | 3809 | 3537 | | | |
| 7. TABLE ACCESS BY INDEX ROWID | CUSTINVOICETRANS | 1. 4560 | 0 | 00:00:00.01 | 0 | 0 | | | |
|* 8 | INDEX RANGE SCAN | I_064INVLINENUMCAMPAIGNOFPRICE | 1. 4560 | 0 | 00:00:00.01 | 0 | 0 | | | |
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
1 - access("J".") "SYS_NC00299$"="T". "' SYS_NC00165$ ' AND SUBSTR (NLS_LOWER ('J'. "" "" REFFACTURE")(, 1, 25) = SUBSTR (NLS_LOWER ("T"." "" "REFFACTURE")(, 1, 25)).
2 - access("J".") INVOICEACCOUNT '= SYS_OP_C2C ("EC". ". ACCOUNTNUM'))
3 - filter("J".") AVAWARDSALES"> 190)
4 - access("J".") SYS_NC00299$ "= U ' 201"AND "J". INVOICEDATE"> = TO_DATE(' 2014-06-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
"J"." SYS_NC00307$ "= U ' 201406"AND "J". INVOICEDATE"< = TO_DATE (' 2014-06-13 00:00:00 ',' syyyy-mm-dd hh24:mi:ss')))
filter ((' J'. "INVOICEDATE' > = 'J' AND TO_DATE(' 2014-06-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss') '." " SYS_NC00307$ "= U '201406' AND"
"J"." INVOICEDATE"< = TO_DATE (' 2014-06-13 00:00:00 ',' syyyy-mm-dd hh24:mi:ss'))))
6 filter (("CE". "SEGMENT_LEVEL" = A "OR"THIS"." SEGMENT_LEVEL "=" E"))
8 - access("T".") SYS_NC00165$ "= U ' 201"AND "T". AVBROCHURELINENUM "= 29457)
filter ("T". ("AVBROCHURELINENUM" = 29457)
EXPLAIN PLAN FOR
Select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * / J.INVOICEACCOUNT, J.INVOICEID, J.INVOICEDATE, (T.LINEAMOUNT + T.LINEAMOUNTTAX) price
of custinvoicejour j join custinvoicetrans t on
substr (nls_lower (j.DataAreaId), 1, 7) = substr (nls_lower (t.dataareaid), 1, 7) and
substr (nls_lower (J.INVOICEID), 1: 25) = substr (nls_lower (t.INVOICEID), 1: 25)
where
substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM = 29457
and substr (nls_lower (j.dataareaid), 1, 7) = '201' and
J.INVOICEACCOUNT in
(select IT. Drmpos.avtr_seg_cust_campend ACCOUNTNUM this where THIS. CAMPAIGN = '201406' and THIS. SEGMENT_LEVEL in (', 'E'))
and J.AVAWARDSALES > 190
and substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406'
"and J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 ';
SELECT * FROM table (DBMS_XPLAN. DISPLAY_CURSOR);
SELECT * FROM table (DBMS_XPLAN. DISPLAY_CURSOR ('7h1nbzqjgwsp7', 2));
SQL_ID, 7h1nbzqjgwsp7, number of children 2
EXPLAIN PLAN for select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * /.
J.INVOICEACCOUNT, J.INVOICEID, J.INVOICEDATE,
(T.LINEAMOUNT + T.LINEAMOUNTTAX) join price j custinvoicejour
CustInvoiceTrans t on substr (nls_lower (j.dataareaid), 1, 7) =
substr (nls_lower (t.DataAreaId), 1, 7) and
= substr (nls_lower (J.INVOICEID), 1: 25)
substr (nls_lower (t.INVOICEID), 1: 25) where
substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM =
29457 and substr (nls_lower, (j.dataareaid), 1, 7) = '201' and
J.INVOICEACCOUNT in (select CE. ACCOUNTNUM of
drmpos.avtr_seg_cust_campend this where THIS. CAMPAIGN = '201406' and
IT. SEGMENT_LEVEL in (', 'E')) and J.AVAWARDSALES > 190 and
substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406' and
"J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 '.
NOTE: cannot fetch SQL_ID plan: 7h1nbzqjgwsp7, CHILD_NUMBER: 2
Check the value of SQL_ID and CHILD_NUMBER;
It could also be that the plan is no longer in the cursor cache (check v$ sql_plan)
NightWing wrote:
Randolf,
I don't understand. What you hear from the above statement that you mean A-lines and E will be incorrect, but the ratio between them remain the same. Therefore, you can deduct the bad things by comparing the differences.
Thus, A-lines always give a wrong result for cancellation of queries, isn't it?
Charlie,
I think that Martin gave a good explanation. Here's another example that hopefully makes more obvious things:
17:56:55 SQL >-things go very wrong here with a small buffer cache
17:56:55 SQL >-T2 lines are badly scattered when you access through T1. FK
17:56:55 SQL >--
17:56:55 SQL >-"Small job" approach would have been a good idea
17:56:55 SQL >-if the estimate of 100 iterations of the loop was correct!
17:56:55 SQL > select
17:56:55 (t2.attr2) count 2
17:56:55 3 of
17:56:55 4 t1
17:56:55 5, t2
17:56:55 6 where
17:56:55 7 /*------------------*/
17:56:55 8 trunc (t1.attr1) = 1
17:56:55 9 and trunc (t1.attr2) = 1
17:56:55 10 / *-* /.
17:56:55 11 and t1.fk = t2.id
17:56:55 12.
T1
*
ERROR on line 4:
ORA-01013: user has requested the cancellation of the current operation
Elapsed time: 00:04:58.30
18:01:53 SQL >
18:01:53 SQL > @xplan_extended_display_cursor ' ' ' ' 'ALLSTATS LAST + COST.
18:01:53 SQL > set echo off verify off termout off
SQL_ID, 353msax56jvvp, number of children 0
-------------------------------------
SELECT count (t2.attr2) from t1, t2 where
/ / *-* trunc (t1.attr1) = 1 and
trunc (T1.attr2) = 1 / *-* / and t1.fk = t2.id
Hash value of plan: 2900488714
------------------------------------------------------------------------------------------------------------------------------------
| ID | The NEST | DSB | Operation | Name | Begins | E - lines. Cost (% CPU). A - lines. A - time | Pads | Bed |
------------------------------------------------------------------------------------------------------------------------------------
| 0 | | 7. SELECT STATEMENT | | 1. | 4999 (100) | 0 | 00:00:00.01 | 0 | 0 |
| 1. 0 | 8 2 GLOBAL TRI | | 1. 1. | 0 | 00:00:00.01 | 0 | 0 |
| 2. 1. 5. NESTED LOOPS | | 1. | | 57516 | 00:04:58.26 | 173K | 30770 |
| 3. 2. 3. NESTED LOOPS | | 1. 100. 4999 (1) | 57516 | 00:00:21.06 | 116K | 3632.
|* 4 | 3. 1. TABLE ACCESS FULL | T1 | 1. 100. 4799 (1) | 57516 | 00:00:00.19 | 1008 | 1087 |
|* 5 | 3. 2. INDEX UNIQUE SCAN | T2_IDX | 57516 | 1. 1 (0) | 57516 | 00:00:20.82 | 115K | 2545 |
| 8 2 2 | 4. TABLE ACCESS BY INDEX ROWID | T2 | 57516 | 1. 2 (0) | 57516 | 00:04:37.14 | 57516 | 27138 |
------------------------------------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
4 filter ((TRUNC ('T1'. "ATTR1") = 1 AND TRUNC ('T1'. " ATTR2') = 1))
5 - access("T1".") FK '= 'T2'.' (ID')
You say here that I canceled a query after about 5 minutes, and looking at the statistics of content (RowSource) I can already say the following:
1. the estimation of cardinality of T1 is far - the optimizer estimated 100 lines, but it actually generated more than 57000 lines when the query was cancelled. If this definitely seems like a candidate at the origin of the problems
2. the query has spent most of the time in search of random table T2
So while it is true that I don't know final A-lines of this cancelled query information, I can still say a lot of this and begin to deal with the problems identified so far.
Randolf
-
10.2.0.5 - execution plan has changed because of the link stealthily
Hi guys,.
Our DB server has very heavy use of the CPU on some days.
After investigation, it is due to a particular change in SQL in the execution plan.
For example, this SQL has SQL_ID: 123, with execution plan 2 (hash value).
PLAN 1 - ABC [GOOD] - scan of systematic index
PLAN 2 - DEF [BAD] - full analysis
Problem SQL < not really sql, for example simplify >
SELECT *.
XX
WHERE CRITERIA =: B1;
I would like to identify the value he threw a look that caused the change in plan 1 plan 2 plan.
In any case, I know?
I also have the SQLT report. But can't really understand the part of connection overview of the report.
Please advise.
Thank youUsing DBMS_XPLAN. DISPLAY_CURSOR, you can use the format mask of '+ PEEKED_BINDS', for example
select * from table(dbms_xplan.display_cursor('
',' ','+PEEKED_BINDS')); Or you can watch V$ SQL. BIND_DATA or, possibly, V$ SQL_PLAN. OTHER_XML although I'm not sure which version the links peeked appear in the latter.
You can use DBMS_SQLTUNE. EXTRACT_BIND/S on the amount GROSS of V$ SQL. (BIND_DATA so) you a license for the tuning pack and b) there is in this version.Published by: Dom Brooks on November 23, 2012 09:54
-
The execution plan changes for the same query.
Hi all
This issue was raised before also, but still not able to find the real cause of this.
Thread1:
Thread2:
It comes, sometimes hammers server 100% CPU utilization with free latch and buffer busy wait events.
We found a single query consumes high CPU usage that is run by different sessions.
This query have two types of execution plans, where one is accurate and is not (its primary key hit index index no appropriate means present on the table)
Because its primary key index hit repeatedly at various sessions, some sessions are powerful db file sequential read and a few sessions waiting buffer busy waits for event. Also during this time a few sessions waiting for latch free event.
My doubt is how to sql even with different literal values execution plan changes and causes a prob.
How to avoid this... why its different execution plan using (I mean bad index PK)select count(*),event from v$session_wait group by event; COUNT(*) EVENT ---------- ---------------------------------------------------------------- 165 SQL*Net message from client 1 SQL*Net message to client 3 buffer busy waits 2 db file parallel read 18 db file sequential read 10 latch free 5 log file sync 1 pmon timer 6 rdbms ipc message 1 smon timer SQL> select sid from v$session_wait where event='db file sequential read'; SID ---------- 26 58 82 107 116 223 212 203 192 173 161 157 150 147 254 238 229 112 101 81 68 SQL> select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID; Enter value for sid: 161 old 1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID new 1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=161 SPID SID SERIAL# PROGRAM --------- ---------- ---------- ------------------------------------------------ 4231 161 49569 oracle@tfrdb3 (TNS V1-V3) SQL> select sql_text from v$process a, v$session b, 2 3 v$sql c where a.addr = b.paddr and b.sql_hash_value = c.hash_value and a.spid = &PID; 4 5 6 7 Enter value for pid: 4231 old 7: a.spid = &PID new 7: a.spid = 4231 SQL_TEXT -------------------------------------------------------------------------------- SELECT ERROR,TIME_STAMP,O_RESOURCE,QUEUE,NEW_QUEUE FROM LOG WHERE ID = '09292AMR 10B41FE' AND TYPE IN (11, 28, 25, 18, 60, 13) AND (LOG_SEQ>'234225222' OR TYPE = 18 AND LOG_SEQ='234225222') ORDER BY TIME_STAMP ASC SQL> set autotrace traceonly exp SQL> SELECT ERROR,TIME_STAMP,O_RESOURCE,QUEUE,NEW_QUEUE FROM amrwf1.LOG WHERE ID = '09292AMR10B41FE' AND TYPE IN (11, 28, 25, 18, 60, 13) AND (LOG_SEQ>'234225222' OR TYPE =18 AND LOG_SEQ='234225222') ORDER BY TIME_STAMP ASC; Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=11 Card=2 Bytes=126) 1 0 SORT (ORDER BY) (Cost=11 Card=2 Bytes=126) 2 1 CONCATENATION 3 2 TABLE ACCESS (BY INDEX ROWID) OF 'LOG' (Cost=4 Card=1 Bytes=63) 4 3 INDEX (UNIQUE SCAN) OF 'PK_LOG_LOG_SEQ' (UNIQUE) (Co st=3 Card=1) 5 2 TABLE ACCESS (BY INDEX ROWID) OF 'LOG' (Cost=4 Card=1 Bytes=63) 6 5 INDEX (RANGE SCAN) OF 'PK_LOG_LOG_SEQ' (UNIQUE) (Cos t=3 Card=1) SQL> select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID; Enter value for sid: 147 old 1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID new 1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=147 SPID SID SERIAL# PROGRAM --------- ---------- ---------- ------------------------------------------------ 6255 147 38306 oracle@tfrdb3 (TNS V1-V3) SQL> select sql_text from v$process a, v$session b, v$sql c 2 3 where a.addr = b.paddr and b.sql_hash_value = c.hash_value and a.spid = &PID; 4 5 6 7 Enter value for pid: 6255 old 7: a.spid = &PID new 7: a.spid = 6255 SQL_TEXT -------------------------------------------------------------------------------- SELECT ERROR,TIME_STAMP,O_RESOURCE,QUEUE,NEW_QUEUE FROM LOG WHERE ID = '09273AMR 62B4894' AND TYPE IN (11, 28, 25, 18, 60, 13) AND (LOG_SEQ>'223324996' OR TYPE = 18 AND LOG_SEQ='223324996') ORDER BY TIME_STAMP ASC SQL> set autotrace traceonly exp SQL> SELECT ERROR,TIME_STAMP,O_RESOURCE,QUEUE,NEW_QUEUE FROM amrwf1.LOG WHERE ID = '09273AMR62B4894' AND TYPE IN (11, 28, 25, 18, 60, 13) AND (LOG_SEQ>'223324996' OR TYPE =18 AND LOG_SEQ='223324996') ORDER BY TIME_STAMP ASC; Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1538 Card=736 Bytes= 46368) 1 0 SORT (ORDER BY) (Cost=1538 Card=736 Bytes=46368) 2 1 TABLE ACCESS (BY INDEX ROWID) OF 'LOG' (Cost=1527 Card=7 36 Bytes=46368) 3 2 INDEX (RANGE SCAN) OF 'LOG_ID' (NON-UNIQUE) (Cost=32 C ard=736) SQL> select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID; Enter value for sid: 82 old 1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID new 1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=82 SPID SID SERIAL# PROGRAM --------- ---------- ---------- ------------------------------------------------ 6172 82 45378 oracle@tfrdb3 (TNS V1-V3) SQL> select sql_text from v$process a, v$session b, v$sql c where a.addr = b.paddr and b.sql_hash_value = c.hash_value and 2 3 a.spid = &PID; 4 5 6 7 Enter value for pid: 6172 old 7: a.spid = &PID new 7: a.spid = 6172 SQL_TEXT -------------------------------------------------------------------------------- INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V 002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010) INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V 002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010) INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V 002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010) SQL_TEXT -------------------------------------------------------------------------------- INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V 002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010) INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V 002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010) INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V SQL_TEXT -------------------------------------------------------------------------------- 002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010) INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V 002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010)
Is it possible to avoid this?
If any details please check out some of my previous post on this specific URL (above)
-YasserMy doubt is how to sql even with different literal values execution plan changes and causes a prob.
Different literal values cause analysis difficult.
Hard analysis includes the re-evaluation of the best path.
Literal value is included in the assessment of the selectivity for the scan interval (log_seq >...)See
http://www.centrexcc.com/A%20Look%20under%20The%20Hood%20Of%20CBO%20-%20The%2010053%20Event.ppt.PDF
http://www.centrexcc.com/fallacies%20Of%20The%20Cost%20Based%20Optimizer.PDF
more the book of Jonathan Lewis which other threads, I believe that you already have.You must lower your CPU.
Previous discussions, if the situation is still the same, it sounded like hard analysis particularly with this SELECTION against the NEWSPAPER plays an important role in that.How to avoid this... why its different execution plan using (I mean bad index PK)
The points raised in the previous discussion remain valid.
-Do you have access to this SQL to change?
for example using bind variable or trick it if necessary due to problems caused by data as discussed in the previous thread.
- Or you could it repoint the view to a view and a hint?
-If a particular user makes this sql, could affect you cursor_sharing just for this user. If not, you should consider implementing pan-Canadian database.Oracle 8.1.6 still?
-
Hello world
I have a little a problem of performance on 12 c that gives me a little trouble at the head. I moved from 11 to 12 databases and no amendment of the application have been made. Our requests are generated somewhat dynamically, so that they are the same thing every time.
Let's start with the execution plan I get:
SQL > select * from table (dbms_xplan.display ());
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hash value of plan: 3567104424
-----------------------------------------------------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | TQ | IN-OUT | PQ Distrib.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 55. 7095 | 3764 (1) | 00:00:01 | | | |
| 1. COORDINATOR OF PX | | | | | | | | |
| 2. PX SEND QC (ORDER). : TQ10006 | 55. 7095 | 3764 (1) | 00:00:01 | Q1, 06 | P > S | QC (ORDER).
| 3. SORT ORDER BY | | 55. 7095 | 3764 (1) | 00:00:01 | Q1, 06 | SVCP | |
| 4. PX RECEIVE | | 55. 7095 | 3763 (1) | 00:00:01 | Q1, 06 | SVCP | |
| 5. RANGE OF SEND PX | : TQ10005 | 55. 7095 | 3763 (1) | 00:00:01 | Q1, 05 | P > P | RANGE |
| 6. UNIQUE FATE | | 55. 7095 | 3763 (1) | 00:00:01 | Q1, 05 | SVCP | |
|* 7 | HASH JOIN | | 55. 7095 | 3762 (1) | 00:00:01 | Q1, 05 | SVCP | |
| 8. PX RECEIVE | | 801 | 50463 | 3696 (1) | 00:00:01 | Q1, 05 | SVCP | |
| 9. PX SEND HASH | : TQ10003 | 801 | 50463 | 3696 (1) | 00:00:01 | Q1, 03 | P > P | HASH |
| * 10 | HASH JOIN | | 801 | 50463 | 3696 (1) | 00:00:01 | Q1, 03 | SVCP | |
| 11. RECEIVE PX | | 801 | 40851 | 2333 (1) | 00:00:01 | Q1, 03 | SVCP | |
| 12. PX SEND BROADCAST | : TQ10002 | 801 | 40851 | 2333 (1) | 00:00:01 | Q1, 02 | P > P | BROADCAST |
| 13. NESTED LOOPS | | 801 | 40851 | 2333 (1) | 00:00:01 | Q1, 02 | SVCP | |
| 14. KIND OF BUFFER. | | | | | Q1, 02 | ISSUE | |
| 15. RECEIVE PX | | | | | | Q1, 02 | SVCP | |
| 16. PX SEND HASH | : TQ10000 | | | | | | S > P | HASH |
| 17. NESTED LOOPS | | 823. 31274 | 1509 (1) | 00:00:01 | | | |
| * 18. TABLE ACCESS BY ROWID INDEX BATCH | PAGED_LOOKUP_PKS | 500 | 9500 | 3 (0) | 00:00:01 | | | |
| * 19. INDEX RANGE SCAN | PAGED_LOOKUP_PKS_IDX2 | 1. | 2 (0) | 00:00:01 | | | |
| 20. TABLE ACCESS BY ROWID INDEX BATCH | BILL_ITEM | 2. 38. 4 (0) | 00:00:01 | | | |
| * 21. INDEX RANGE SCAN | BILL_ITEM_FK2 | 4. | 2 (0) | 00:00:01 | | | |
| * 22. INDEX UNIQUE SCAN | PK_INSERTION | 1. 13. 1 (0) | 00:00:01 | Q1, 02 | SVCP | |
| 23. ITERATOR BLOCK PX | | 1548K | 17 M | 1353 (2) | 00:00:01 | Q1, 03 | ISSUE | |
| 24. FULL RESTRICTED INDEX SCAN FAST | BOOKING_ACCOUNT_1 | 1548K | 17 M | 1353 (2) | 00:00:01 | Q1, 03 | SVCP | |
| 25. PX RECEIVE | | 22037 | 1420K | 65 (2) | 00:00:01 | Q1, 05 | SVCP | |
| 26. PX SEND HASH | : TQ10004 | 22037 | 1420K | 65 (2) | 00:00:01 | Q1, 04 | S > P | HASH |
| 27. SELECTOR PX | | | | | | Q1, 04 | SCWC | |
| 28. TABLE ACCESS FULL | CONTACT | 22037 | 1420K | 65 (2) | 00:00:01 | Q1, 04 | SCWP | |
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
7 - access ("ACCOUNT_ID" ="ACCOUNT_ID")
10 - access ("BOOKING" ="BOOKING")
18 - filter("T1".") SEQUENCE_NO' < 501 AND "T1". ("' SEQUENCE_NO" > = 1).
19 - access("T1".") SESSION_ID '= 123456 AND 'T1'.' SEARCH_ID "= 25)
21 - access("T1".") N1 "=" BILL_ID")
22 - access ("BOOKING" = "BOOKING" AND "INSERTION_SET" = "INSERTION_SET" AND "INSERT"="INSERT")
Note
-----
-the dynamic statistics used: dynamic sampling (level = 2)
-This is an adaptation plan
-2 directives Plan Sql used for this statement
51 selected lines.
Elapsed time: 00:00:00.15
SQL > spool off
OK, now let's go through the problem:
- It's a development running on a virtual server, and which hosts a few other databases, so the parallel execution is not a good thing. parallel_degree_policy is set to MANUAL, parallel_max_servers and all other parallel_ limits are set to 1 and tables have been changed with the settings of NOPARALLEL. So why is the execution plan always generated with all stages of parallel execution? I don't seem to get rid of in 12 c
- Next mystery is that the said plan of the explain command is an adaptation plan, and yet I put the true optimizer_adaptive_reproting_only
- Now to the problem of effective enforcement, so I'm playing around with all these settings. The query runs for 3-4 seconds, returning around about 500 cases. However, in some cases this same query with the same input variable races for hours and if I can believe the AWR and ASH reports, read a good 180 GB of data. The main wait event is direct path read temp temp and writing.
This is not isolated to that one query. I have a few queries now that all display the same behavior, one of them running overnight. I don't seem to get to a standard nested loop execution plans.
The entire base is a database plug-in and I don't know I just missed something in the new features Guide.
Would appreciate some ideas.
Thank you
If you want to disable parallel execution, you must set parallel_max_servers to zero. Maybe the optimizer thinks he can use a parallel plan because parallel_max_servers is non-zero (even though the number of slaves available means that it will be serialized to a parallel plan).
Note that you have a ticket saying dynamic stats have been used. Maybe you have a 11 for optimizer_dynamic_sampling setting, and allowing Oracle to be very inventive with collection of samples and parallelism.
You have also 2 SQL instructions in game. These are the things that get associated with objects rather than the instructions, then perhaps someone has been playing with parallelism and managed to associate the parallelism with one of the tables in your query (I am not sure 100% that it is possible, just throw a suggestion). Take a look at the SQL used for education guidelines.
To give us a little more information, you can:
Shoot memory execution plan dbms_xplan.display_cursor ({sql_id}, {number of children}, 'ALL'));
We show all the parallel settings (see setting the parallel)
Pull on the parameters of the optimizer for query memory (select name, value of V$ sql_optimizer_env where sql_id = {your sql identifier} and child_number = {your child number})
Concerning
Jonathan Lewis
-
"Execution plan is not available" in OEM.
Greetings. Try to watch my first Exec Plan here and make the message displayed above in OEM 11 g even executing simple statements like below. I googled this and see only one question without an answer identical to this.
Thank you!
explain plan for
Select * from SCOTT. DEPT;
Don't know why you're looking for a plan in OEM.
* Connect to the base of data with the help of sqlplus and wwho and extract the map below;
SQL > explain plan for select * from SCOTT. DEPT;
SQL > SELECT * FROM TABLE (dbms_xplan.display);
* Very easy, set autotrace on and run the query, you will get the plan and statistics;
SQL > set autotrace
Syntax: SET AUTOT [RACE] {OFF |} WE | TRACE [ONLY]} [EXP [LAIN]] [[C] STAT]
SQL > set autotrace on
SQL > select * from double;
D
-
X
Execution plan
----------------------------------------------------------
Hash value of plan: 272002086
--------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1. 2. 2 (0) | 00:00:01 |
| 1. TABLE ACCESS FULL | DOUBLE | 1. 2. 2 (0) | 00:00:01 |
--------------------------------------------------------------------------
Statistics
----------------------------------------------------------
1 recursive calls
0 db block Gets
Gets 2 compatible
0 physical reads
0 redo size
522 bytes sent via SQL * Net to client
523 bytes received via SQL * Net from client
2 SQL * Net back and forth to and from the client
0 sorts (memory)
0 sorts (disk)
1 rows processed
HTH,
Pradeep
-
I'm testing a huge application with a database middleware sophisticated against the Oracle 12 database. So far, it works well with Pervasive SQL, MSSQL and Oracle 8 database... 11.
There are many questions about execution plans changed from Version 11 to 12. Oracle will tell what all of the improvements are (or at least have to improvements), and I can't really denied him. It's not the subject.
But I met some SQLs with horrible execution time, especially connected to Crystal Reports. Whenever I tried to check them, the queries have been executed quickly. As far as I can see, this has to do with the schema/user who executes the SQL statement in a first time. Here are the details:
• = ADMIN, DML = GUI DDL: all data are stored in a scheme of the ADMIN. The ADMIN user creates the tables, views and so on. It grants access to and creates synonyms for users, but it cannot modify the data using DML, given that triggers prevent him. End users, named 'GUI' users, are allowed to use the DML, but they have no privileges DDL.
• Database of reports (on paper) are generally quite complex. They have only a limited data set (must fit on sheets of paper!), and the Oracle optimizer optimizes often against this goal. Because Crystal Reports generates no advice, most of the reports are based on a view ADMIN. < xyz > (with the necessary information) and are accessible via a GUI. < xyz > synonym of user GUI.
• Crystal Reports running slowly (~ 5 minutes) connected as a GUI. I export it, get the SQL export, log in as an ADMINISTRATORand run the query, it works quickly (~ 2 seconds). Well, I've probably changed some white space, the line endings and others then copy / paste, I don't?
• I tried many things, connecting both GUI and ADMIN, simplifying the application, execution and so on. Then I got confused version of who this query: when the ADMIN has added an additional space character it was fast, removed again and it was slow again. Whitespace have an influence on the execution plan? Probably not, and if yes, my vision of the world would collapse.
• Later, I found out: in Version 12, depends on the user executing this query. Nail down us the source of the query for the synonym GUI. < xyz >. Let us make a new version of it (coded by white space - smile), and if run you it like GUI first, it's slow. Even if you re - log on as ADMINISTRATOR, the same version of this query is still slow. (This is a bug!)
Question 1: When I prepend the SQL with 'EXPLAIN PLAN FOR', I seem to be changing. As GUI has no plan_table and no privilege to explain a plan, I can't spy on the implementation plan of 'bad '. I don't want to give too much GUI, and I fear it could alter the execution plan. Is there a trick to get the plan of execution of a SQL statement in v$ sql or v$ sqlarea? (Means: execute the query: GUI and explain it as an ADMINISTRATOR)
Question 2: Is this on the privileges of the GUI? What you think, what direction will further investigate?
Oracle database generates an execution plan based on SQL, the dictionary, the statistics, the privileges of the user of the analysis and database and session settings. One of the privileges is GRANT MERGE [ALL] DISPLAY, which was responsible for the difference in this particular example and in this particular version.
When you log on as another user and run the same code in SQL, Oracle database verifies all required components before she reuses the old execution plan. This is a minor bug, but it is.
In the example, the privilege GRANT MERGE ANY NOTICE was given implicitly by the DBA privilege. Because MERGE ANY VIEW disables security controls, the privilege of s/n, default, also disables security controls. This is not a desired behavior from the DBA privilege.
-
What is the correct procedure of DMBS_XPLAN for the query execution plan
Hello.
We are on Oracle 11.2.0.3 on Linux. I am dev. DBA and we have about 80 developers Java development team. They want to question the execution plan of queries to resolve the sqls. Generally, they use the GUI tools like the toad to see execution plan. I always use the procedure for the following query execution plan:
Select * from
Table (dbms_xplan.display_cursor (null, null, 'allstats + cost'));I should suggest that they use this too rather than rely on tools like the toad - because they can show estimated plan and not the actual plan. And to provide a sql, it is best to use the real plan to work with. Do not take account of 'allstats + cost' part in the command above, but my point is: should I ask them of still rely on sqlplus and not the GUI tools and use the command display_cursor package DBMS_XPLAN?
I will be grateful for suggestions.
OrauserN
You must use the DBMS_XPLAN package and functionality.
The tool used to run the package doesn't matter. A raw request to DISPLAY_CURSOR will run the same server code in any tool including Toad.
If you rely on other GUI features (for example a "explain plan" button or similar) then you know what this feature of actuall application running under-the-covers.
My suggestion would be to assess and consider using Oracle free sql developer version 4 because it is not only FREE but also uses the DBMS_XPLAN correctly.
-
Why sql_trace sometimes generate an execution plan
I use "alter session set sql_trace = true;" to trace a package.
I use the tkprof to format the raw trace with no options.
But there's one thing confuses me.
In the trace of any statement have plans of execution as below.
SELECT BATCH_ID FROM OPS_DW_BUSINESS_DT WHERE CURRENT_I = 'Y' AND OPS_NAME = :B1 call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 2 0.00 0.00 0 0 0 0 Fetch 2 0.00 0.00 1 2 0 2 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 5 0.00 0.00 1 2 0 2 Misses in library cache during parse: 1 Misses in library cache during execute: 1 Optimizer mode: ALL_ROWS Parsing user id: 61 (recursive depth: 1) Rows Row Source Operation ------- --------------------------------------------------- 2 INDEX RANGE SCAN OPS_DW_BUSINESS_DT_IDX1 (cr=2 pr=1 pw=0 time=350 us)(object id 135871)
Any statement have no implementation plan
******************************************************************************** SELECT ACTIVITY_CODE,TRIP,EQUIPMENT_N,LOCATION,DISC_VSL_NAME,DISC_VOY, LOAD_VSL_NAME,LOAD_VOY,MOVE_OPS, ACTIVITY_DT, ACT_SEQ, LAG(TRIP, 1) OVER(ORDER BY TRIP, ACTIVITY_DT, ACT_SEQ) AS PREV_TRIP, LEAD(TRIP, 1) OVER(ORDER BY TRIP, ACTIVITY_DT, ACT_SEQ) AS NEXT_TRIP FROM OIS_HRLY_PMOPS B WHERE ( BATCH_ID = :B3 AND (INSTR(:B2 , ACTIVITY_CODE) <> 0 OR INSTR(:B1 , ACTIVITY_CODE) <> 0) ) OR ( BATCH_ID < :B3 AND (INSTR(:B2 , ACTIVITY_CODE) <> 0 OR INSTR(:B1 , ACTIVITY_CODE) <> 0) AND EXISTS (SELECT 1 FROM OIS_HRLY_PMOPS C WHERE C.BATCH_ID = :B3 AND C.TRIP=B.TRIP) ) ORDER BY TRIP, ACTIVITY_DT, ACT_SEQ call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 1 0.02 0.01 0 0 0 0 Fetch 2246 25.77 24.87 0 46319 0 224517 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 2248 25.79 24.88 0 46319 0 224517 Misses in library cache during parse: 1 Misses in library cache during execute: 1 Optimizer mode: ALL_ROWS Parsing user id: 61 (recursive depth: 1) ********************************************************************************
I know that I can use the tkprof explain = name of user and password to force generate a. But for the time being. Why some statement make execution plan while others have not?
Concerning
Monique
> Source line operation lines
What you have is Source line operations - the * real * execution plan.
The EXPLAIN command option gives you the estimated execution plan.
Why didn't you not operations Source online for all SQLs? Row Source operations are printed only if the cursor is closed. Usually in pure SQL sessions, SQL cursor is closed when the following SQL is running. However, with PLSQL and stored procedures, the procedure cannot close the cursor for the SQL statement, it calls (closing is made when the session is closed). In such a case, the operations line Source not to print.
Hemant K Collette
Maybe you are looking for
-
Hey.I would like to translate client thunderbird in Latvian. Is this possible? Best wishesJanis diamonds (Prusljix)
-
Create an executable version for eurotherm driver tools
Hello I would like to know if anyone has or can create an executable version from the instrument to the eurotherm 3216 vi driver monitoring temperature control. I downloaded the file from the Web site or http://sine.ni.com/apps/utf8/niid_web_display.
-
After installing SP3 on XP can not get computer to boot...
I installed SP3 on XP. When I turn on the computer, it takes me to the screen to select a start upward. I does not start in safe mode, when I choose the other options of the Windows XP screen comes up but it does not start...
-
Please provide me with the identification of email from Microsoft support?
Please give me someone Microsoft Support email id Thank you Atul Khayat E-mail address is removed from the privacy *.
-
How to set the time on an officejet pro 8600
where should I go to set the time on my office jet pro 8600