Query Need to tune
Dear Experts,
Is this plan need improvement ?
SQL> select * from table(dbms_xplan.display_awr('1hc2rwf9u3p45'));
PLAN_TABLE_OUTPUT
SQL_ID 1hc2rwf9u3p45
SELECT W.QUEUENAME, COUNT(W.QUEUENAME) AS COUNT FROM table1 W, table2
I WHERE
(I.CLEARINGDATE=TO_CHAR(SYSDATE,'DD/MM/YYYY') OR I.CLEARINGDATE=TO_CHAR(SYSDATE-
1,'DD/MM/YYYY') OR
I.CLEARINGDATE=TO_CHAR(SYSDATE-2,'DD/MM/YYYY') OR I.CLEARINGDATE=TO_CHAR(SYSDATE
-3,'DD/MM/YYYY') OR
PLAN_TABLE_OUTPUT
I.CLEARINGDATE=TO_CHAR(SYSDATE-4,'DD/MM/YYYY') OR I.CLEARINGDATE=TO_CHAR(SYSDATE
-5,'DD/MM/YYYY')) AND
I.INSTANCEID = W.PROCESSINSTANCEID GROUP BY W.QUEUENAME
Plan hash value: 2530106149
| Id | Operation | Name | Rows | Bytes
PLAN_TABLE_OUTPUT
|TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | |
| | 30399 (100)| |
| 1 | SORT GROUP BY | | 12 | 1488
| | 30399 (1)| 00:02:53 |
PLAN_TABLE_OUTPUT
| 2 | HASH JOIN | | 66064 | 7999
K| 3168K| 30393 (1)| 00:02:53 |
| 3 | INLIST ITERATOR | | |
| | | |
| 4 | TABLE ACCESS BY INDEX ROWID| table2 | 66064 | 2387
K| | 5653 (1)| 00:00:33 |
| 5 | INDEX RANGE SCAN | IDX_table3_CLEARINGDATE | 66064 |
| | 175 (2)| 00:00:01 |
PLAN_TABLE_OUTPUT
| 6 | INDEX FAST FULL SCAN | I | 2291K| 190
M| | 13801 (1)| 00:01:19 |
22 rows selected.Thanks&Regards
Sunil Kumar
Hello,
First you gather statistics on all the database tables.you can also gather statistics on those tables only.Second explain statement will show you the actual cost of this statement.the explain statement will show you the cost and if this query is doing sof or hard parsing.
Kind regards
Mohamed
Oracle DBA
Similar Messages
-
I have one query below to tune.
Here one table USER_RETAILER_MAP and its column BELONGS_TO having value only 'Y' and 'N'.
Created bitmap index but i am not getting any cost difference.
Please share your idea ,how to tune and what process should follow.
SQL> explain plan for
2 SELECT a.user_id,
3 a.user_nm,
4 2 AS max_level
5 FROM gss_user a
6 WHERE a.user_id NOT IN (SELECT user_id
7 FROM user_retailer_map
8 WHERE retailer_id IN (SELECT b.retailer_id
9 FROM user_retailer_map b,
10 retailer c
11 WHERE
12 b.retailer_id = c.retailer_id
13 AND b.user_id = :a
14 AND c.status = 'ACTIVE'
15 AND b.managed_by = 'Y')
16 AND belongs_to = 'Y')
17 AND Upper(a.status) = 'ACTIVE'
18 AND a.user_id IN (SELECT user_id
19 FROM user_hierarchy
20 WHERE parent_user_id = :b)
21 AND a.gmac_dealer_user_flg = 'D'
22 ORDER BY Upper(user_nm) ASC
23 ;
Explained.
SQL> @utlxpls
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1 | 91 | 65 |
| 1 | SORT ORDER BY | | 1 | 91 | 65 |
|* 2 | HASH JOIN ANTI | | 1 | 91 | 63 |
| 3 | NESTED LOOPS SEMI | | 7 | 504 | 9 |
|* 4 | TABLE ACCESS FULL | GSS_USER | 33 | 1254 | 9 |
|* 5 | INDEX UNIQUE SCAN | XPKGSS_USER_HIERARCHY | 7 | 238 | |
| 6 | VIEW | VW_NSO_1 | 212 | 4028 | 53 |
|* 7 | HASH JOIN | | 212 | 15476 | 53 |
|* 8 | HASH JOIN | | 15 | 675 | 9 |
| 9 | TABLE ACCESS BY INDEX ROWID| USER_RETAILER_MAP | 15 | 420 | 4 |
|* 10 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 15 | | 1 |
|* 11 | INDEX FAST FULL SCAN | INDX_RETAILE | 1594 | 27098 | 4 |
|* 12 | TABLE ACCESS FULL | USER_RETAILER_MAP | 22885 | 625K| 43 |
Predicate Information (identified by operation id):
2 - access("A"."USER_ID"="VW_NSO_1"."$nso_col_1")
4 - filter(UPPER("A"."STATUS")='ACTIVE' AND "A"."GMAC_DEALER_USER_FLG"='D')
5 - access("A"."USER_ID"="USER_HIERARCHY"."USER_ID" AND "USER_HIERARCHY"."PARENT_USER
_ID"=:Z)
7 - access("USER_RETAILER_MAP"."RETAILER_ID"="B"."RETAILER_ID")
8 - access("B"."RETAILER_ID"="C"."RETAILER_ID")
10 - access("B"."USER_ID"=:Z AND "B"."MANAGED_BY"='Y')
11 - filter("C"."STATUS"='ACTIVE')
12 - filter("USER_RETAILER_MAP"."BELONGS_TO"='Y')
}How to post a SQL statement tuning request...
HOW TO: Post a SQL statement tuning request - template posting -
Do I need to tune the base query of my materialized view ?
Hi gurus,
We implement materialized view (FAST REFRESH ON COMMIT) on base table used in OLTP system. In fact the MV itself is also queried by the OLTP system itself, interactively.
Currently user complain that after they input transaction, they see that the MV is not refresh as soon as they commit the transaction.
(it takes 5 to 10 minutes before they see the update on the MV)
The query of the MV is attached below, it consists of union all of two queries but actually the real query has 13 queries on a UNION ALL.
The question is :
Do I need to tune the query that forms the MV ?
Does it impact the refresh time of the MV ?
Thank you for your help,
xtanto
SELECT GRNH.DOC_CODE ||' '|| GRNH.GRN_NO, GRNH.GRN_DATE, GRNH.REGS_CODE,
F_Convert_Qty_K(GRND.PRODUCT, GRND.QTY, GRND.UOM) QTY_IN, 0 QTY_OUT, 0 QTY_ADJ, 'N/A'.....
FROM GRN_LOCAL_D GRND
JOIN GRN_LOCAL_H GRNH ON GRNH.GRNH_ID = GRND.GRNH_ID
WHERE GRND.PRODUCT IS NOT NULL AND GRNH.WH_CODE IS NOT NULL
UNION ALL
SELECT GRNH.DOC_CODE ||' '|| GRNH.GRN_NO, GRNH.GRN_DATE, GRNH.REGS_CODE,
F_Convert_Qty_K(GRND.PRODUCT_B, GRND.QTY_B, GRND.UOM_B) QTY_IN, 0 QTY_OUT, 0 QTY_ADJ, 'N/A'...
FROM GRN_LOCAL_D GRND
JOIN GRN_LOCAL_H GRNH ON GRNH.GRNH_ID = GRND.GRNH_ID
WHERE GRND.PRODUCT_B IS NOT NULL AND GRNH.WH_CODE IS NOT NULL
UNION ALL
......Hi Justin & APC,
Are they seeing a 5-10 minute delay in being able to commit their transaction?NO, the commit itself is completed normally, but after that when they go to the page (this is webbased app) that display data from the MV, the newly committed transactionis not there yet. Only after 5-10 minutes we can see the new data.
What does the F_Convert_Qty_K() function do?It is a function that convert the quantity from whatever Unit Of Measurement (UOM) into the smallest UOM. Below is the code.
So the question remains:
why intermittently theere is delay before the new data visible in the MV ?
Thanks you,
xtanto
CREATE OR REPLACE FUNCTION F_Convert_Qty (pProduct VARCHAR2, pQty NUMBER, pUOM VARCHAR2)
RETURN NUMBER
IS
vQtyBase NUMBER(13,5);
BEGIN
SELECT CASE WHEN pUOM = ( SELECT UOM_BASE FROM PRODUCTS WHERE PRODUCT = pProduct)
THEN pQty
ELSE
SELECT ROUND(pQty * Coefficient / Divisor, 5)
FROM (
SELECT Coefficient, Divisor FROM CONVERT_UOM
WHERE PRODUCT = pProduct AND UOM_CONVERT = pUOM
) tmp
END INTO vQtyBase FROM DUAL;
--RETURN (vQtyBase) ;
RETURN ( NVL(vQtyBase,0) ) ;
END F_Convert_Qty;
/ -
Hi,
I'm using below query inside the procedure.I need to tune this query as it is taking more time for execution.Could you some help on this
*version.*
10.2.0
Query
INSERT INTO TEMP_TEST_STAT(
SELECT S.STUDENT_ID_PK, A.RESPONSE_KEY GENDER, B.RESPONSE_KEY ETHNICITY, T.SCORE SCALE_SCORE ,D.TEST_NAME
FROM TEST_SESSION_DETAIL T, TEST_SESSION S, STUDENT U, TEST_DETAIL D,
SELECT I.ITEM_ID, I.UIN, BG.BG_SESSION_DETAIL_ID, BG.RESPONSE_KEY , B.TEST_SESSION_ID, C.STUDENT_ID_PK
FROM BG_QUESTION_USER_RESPONSE BG, ITEM I, BG_SESSION_DETAIL B, TEST_SESSION C
WHERE
BG.ITEM_ID = I.ITEM_ID AND I.UIN = 'SBG002' AND
BG.BG_SESSION_DETAIL_ID = B.BG_SESSION_DETAIL_ID
AND B.TEST_SESSION_ID = C.TEST_SESSION_ID ) A,
SELECT I.ITEM_ID, I.UIN, BG.BG_SESSION_DETAIL_ID, BG.RESPONSE_KEY , B.TEST_SESSION_ID, C.STUDENT_ID_PK
FROM BG_QUESTION_USER_RESPONSE BG, ITEM I, BG_SESSION_DETAIL B, TEST_SESSION C
WHERE
BG.ITEM_ID = I.ITEM_ID AND I.UIN = 'SBG001' AND
BG.BG_SESSION_DETAIL_ID = B.BG_SESSION_DETAIL_ID
AND B.TEST_SESSION_ID = C.TEST_SESSION_ID ) B
,INSTITUTION E
WHERE
D.TEST_NAME = 'Reading Comprehension' AND
T.TEST_SESSION_STATUS_ID = 3
AND TRUNC(T.TEST_END_DATE) BETWEEN TO_DATE('01-09-09','DD-MON-YY') AND TO_DATE('30-09-09','DD-MON-YY')
AND T.TEST_DETAIL_ID = D.TEST_DETAIL_ID
AND S.STUDENT_ID_PK = U.STUDENT_ID_PK
AND S.TEST_SESSION_ID = T.TEST_SESSION_ID
AND A.TEST_SESSION_ID = T.TEST_SESSION_ID
AND A.STUDENT_ID_PK = S.STUDENT_ID_PK
AND B.TEST_SESSION_ID = T.TEST_SESSION_ID
AND B.STUDENT_ID_PK = S.STUDENT_ID_PK
AND S.INSTITUTION_ID=E.INSTITUTION_ID
AND SUBSTR(E.INSTITUTION_ID_DISPLAY,8,3) <> '000');
Explain plan
PLAN_TABLE_OUTPUT
Plan hash value: 790379856
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | INSERT STATEMENT | | 1 | 204 | 1567 (1)| 00:00:19 | | |
|* 1 | FILTER | | | | | | | |
| 2 | NESTED LOOPS | | 1 | 204 | 1567 (1)| 00:00:19 | | |
| 3 | NESTED LOOPS | | 1 | 189 | 1566 (1)| 00:00:19 | | |
| 4 | NESTED LOOPS | | 1 | 167 | 1561 (1)| 00:00:19 | | |
| 5 | NESTED LOOPS | | 1 | 155 | 1560 (1)| 00:00:19 | | |
| 6 | NESTED LOOPS | | 1 | 143 | 1556 (1)| 00:00:19 | | |
| 7 | NESTED LOOPS | | 1 | 128 | 1555 (1)| 00:00:19 | | |
| 8 | NESTED LOOPS | | 1 | 106 | 1550 (1)| 00:00:19 | | |
| 9 | NESTED LOOPS | | 186 | 17484 | 1364 (1)| 00:00:17 | | |
|* 10 | HASH JOIN | | 86 | 7052 | 1020 (1)| 00:00:13 | | |
| 11 | NESTED LOOPS | | 86 | 5848 | 1002 (1)| 00:00:13 | | |
|* 12 | HASH JOIN | | 86 | 4472 | 916 (1)| 00:00:11 | | |
|* 13 | INDEX RANGE SCAN | TEST_DETAIL_AK_1 | 1 | 21 | 2 (0)| 00:00:01 | | |
|* 14 | TABLE ACCESS BY GLOBAL INDEX ROWID| TEST_SESSION_DETAIL | 8549 | 258K| 914 (1)| 00:00:11 | ROWID | ROWID |
|* 15 | INDEX RANGE SCAN | TEST_END_DATE_IDX | 15672 | | 53 (0)| 00:00:01 | | |
| 16 | PARTITION HASH ITERATOR | | 1 | 16 | 1 (0)| 00:00:01 | KEY | KEY |
| 17 | TABLE ACCESS BY LOCAL INDEX ROWID | TEST_SESSION | 1 | 16 | 1 (0)| 00:00:01 | KEY | KEY |
|* 18 | INDEX UNIQUE SCAN | PK_TEST_SESSION | 1 | | 0 (0)| 00:00:01 | KEY | KEY |
|* 19 | INDEX FAST FULL SCAN | INSTI_ID_NAME_COUN_DISP_IDX | 5930 | 83020 | 17 (0)| 00:00:01 | | |
| 20 | TABLE ACCESS BY GLOBAL INDEX ROWID | BG_SESSION_DETAIL | 2 | 24 | 4 (0)| 00:00:01 | ROWID | ROWID |
|* 21 | INDEX RANGE SCAN | BG_SESS_DETAIL_TEST_SE_FK1_I | 2 | | 2 (0)| 00:00:01 | | |
| 22 | PARTITION HASH ITERATOR | | 1 | 12 | 1 (0)| 00:00:01 | KEY | KEY |
|* 23 | TABLE ACCESS BY LOCAL INDEX ROWID | TEST_SESSION | 1 | 12 | 1 (0)| 00:00:01 | KEY | KEY |
|* 24 | INDEX UNIQUE SCAN | PK_TEST_SESSION | 1 | | 0 (0)| 00:00:01 | KEY | KEY |
| 25 | TABLE ACCESS BY GLOBAL INDEX ROWID | BG_QUESTION_USER_RESPONSE | 4 | 88 | 5 (0)| 00:00:01 | ROWID | ROWID |
|* 26 | INDEX RANGE SCAN | BG_QUESTION_USER_RESP_IDX1 | 4 | | 2 (0)| 00:00:01 | | |
| 27 | PARTITION HASH ITERATOR | | 1 | 15 | 1 (0)| 00:00:01 | KEY | KEY |
|* 28 | TABLE ACCESS BY LOCAL INDEX ROWID | ITEM | 1 | 15 | 1 (0)| 00:00:01 | KEY | KEY |
|* 29 | INDEX UNIQUE SCAN | PK_ITEM | 1 | | 0 (0)| 00:00:01 | KEY | KEY |
| 30 | TABLE ACCESS BY GLOBAL INDEX ROWID | BG_SESSION_DETAIL | 2 | 24 | 4 (0)| 00:00:01 | ROWID | ROWID |
|* 31 | INDEX RANGE SCAN | BG_SESS_DETAIL_TEST_SE_FK1_I | 2 | | 2 (0)| 00:00:01 | | |
| 32 | PARTITION HASH ITERATOR | | 1 | 12 | 1 (0)| 00:00:01 | KEY | KEY |
|* 33 | TABLE ACCESS BY LOCAL INDEX ROWID | TEST_SESSION | 1 | 12 | 1 (0)| 00:00:01 | KEY | KEY |
|* 34 | INDEX UNIQUE SCAN | PK_TEST_SESSION | 1 | | 0 (0)| 00:00:01 | KEY | KEY |
| 35 | TABLE ACCESS BY GLOBAL INDEX ROWID | BG_QUESTION_USER_RESPONSE | 4 | 88 | 5 (0)| 00:00:01 | ROWID | ROWID |
|* 36 | INDEX RANGE SCAN | BG_QUESTION_USER_RESP_IDX1 | 4 | | 2 (0)| 00:00:01 | | |
| 37 | PARTITION HASH ITERATOR | | 1 | 15 | 1 (0)| 00:00:01 | KEY | KEY |
|* 38 | TABLE ACCESS BY LOCAL INDEX ROWID | ITEM | 1 | 15 | 1 (0)| 00:00:01 | KEY | KEY |
|* 39 | INDEX UNIQUE SCAN | PK_ITEM | 1 | | 0 (0)| 00:00:01 | KEY | KEY |
Predicate Information (identified by operation id):
1 - filter(TO_DATE('01-09-09','DD-MON-YY')<=TO_DATE('30-09-09','DD-MON-YY'))
10 - access("S"."INSTITUTION_ID"="E"."INSTITUTION_ID")
12 - access("T"."TEST_DETAIL_ID"="D"."TEST_DETAIL_ID")
13 - access("D"."TEST_NAME"='Reading Comprehension')
14 - filter("T"."TEST_SESSION_STATUS_ID"=3)
15 - access(TRUNC(INTERNAL_FUNCTION("TEST_END_DATE"))>=TO_DATE('01-09-09','DD-MON-YY') AND
TRUNC(INTERNAL_FUNCTION("TEST_END_DATE"))<=TO_DATE('30-09-09','DD-MON-YY'))
18 - access("S"."TEST_SESSION_ID"="T"."TEST_SESSION_ID")
19 - filter(SUBSTR("E"."INSTITUTION_ID_DISPLAY",8,3)<>'000')
21 - access("B"."TEST_SESSION_ID"="T"."TEST_SESSION_ID")
23 - filter("C"."STUDENT_ID_PK"="S"."STUDENT_ID_PK")
24 - access("B"."TEST_SESSION_ID"="C"."TEST_SESSION_ID")
26 - access("BG"."BG_SESSION_DETAIL_ID"="B"."BG_SESSION_DETAIL_ID")
28 - filter("I"."UIN"='SBG001')
29 - access("BG"."ITEM_ID"="I"."ITEM_ID")
31 - access("B"."TEST_SESSION_ID"="T"."TEST_SESSION_ID")
33 - filter("C"."STUDENT_ID_PK"="S"."STUDENT_ID_PK")
34 - access("B"."TEST_SESSION_ID"="C"."TEST_SESSION_ID")
36 - access("BG"."BG_SESSION_DETAIL_ID"="B"."BG_SESSION_DETAIL_ID")
38 - filter("I"."UIN"='SBG002')
39 - access("BG"."ITEM_ID"="I"."ITEM_ID")Rob,
How i can my insert statement here.
I tried like..but error.
select /*+ gather_plan_statistics */ INSERT INTO TEMP_TEST_STAT(
SELECT S.STUDENT_ID_PK, A.RESPONSE_KEY GENDER, B.RESPONSE_KEY ETHNICITY, T.SCORE SCALE_SCORE ,D.TEST_NAME
FROM TEST_SESSION_DETAIL T, TEST_SESSION S, STUDENT U, TEST_DETAIL D,
SELECT I.ITEM_ID, I.UIN, BG.BG_SESSION_DETAIL_ID, BG.RESPONSE_KEY , B.TEST_SESSION_ID, C.STUDENT_ID_PK
FROM BG_QUESTION_USER_RESPONSE BG, ITEM I, BG_SESSION_DETAIL B, TEST_SESSION C
WHERE
BG.ITEM_ID = I.ITEM_ID AND I.UIN = 'SBG002' AND
BG.BG_SESSION_DETAIL_ID = B.BG_SESSION_DETAIL_ID
AND B.TEST_SESSION_ID = C.TEST_SESSION_ID ) A,
SELECT I.ITEM_ID, I.UIN, BG.BG_SESSION_DETAIL_ID, BG.RESPONSE_KEY , B.TEST_SESSION_ID, C.STUDENT_ID_PK
FROM BG_QUESTION_USER_RESPONSE BG, ITEM I, BG_SESSION_DETAIL B, TEST_SESSION C
WHERE
BG.ITEM_ID = I.ITEM_ID AND I.UIN = 'SBG001' AND
BG.BG_SESSION_DETAIL_ID = B.BG_SESSION_DETAIL_ID
AND B.TEST_SESSION_ID = C.TEST_SESSION_ID ) B
,INSTITUTION E
WHERE
D.TEST_NAME = 'Reading Comprehension' AND
T.TEST_SESSION_STATUS_ID = 3
AND TRUNC(T.TEST_END_DATE) BETWEEN TO_DATE('01-09-09','DD-MON-YY') AND TO_DATE('30-09-09','DD-MON-YY')
AND T.TEST_DETAIL_ID = D.TEST_DETAIL_ID
AND S.STUDENT_ID_PK = U.STUDENT_ID_PK
AND S.TEST_SESSION_ID = T.TEST_SESSION_ID
AND A.TEST_SESSION_ID = T.TEST_SESSION_ID
AND A.STUDENT_ID_PK = S.STUDENT_ID_PK
AND B.TEST_SESSION_ID = T.TEST_SESSION_ID
AND B.STUDENT_ID_PK = S.STUDENT_ID_PK
AND S.INSTITUTION_ID=E.INSTITUTION_ID
AND SUBSTR(E.INSTITUTION_ID_DISPLAY,8,3) '000') from dual;please advice -
hi,
I am not familiar with sql query tuning know only i started learning basics so please any body can help regaring below mentioned query how to tune it.
SELECT T.TERMINALID, DECODE(A.AGENT_STATUS, 1,T.TERMINAL_STATUS,0) AS STATUS, T.SHIPMENTTYPE
FROM (SELECT TM1.TERMINALID, TM1.SHIPMENTTYPE, DECODE(TERMINALSTATUS ,'N',0,1) AS TERMINAL_STATUS
FROM (SELECT TERMINALID, SHIPMENTTYPE
FROM FS_FR_TERMINALMASTER )TM1,
(SELECT AGENTID, PROPERTY_VALUE AS TERMINALSTATUS
FROM FS_FR_AGENTHISTORY
WHERE PROPERTY_NAME ='TERMINAL_STATUS'
AND PROPERTY_DATE IN(SELECT MAX(PROPERTY_DATE)
FROM FS_FR_AGENTHISTORY
WHERE PROPERTY_NAME ='TERMINAL_STATUS'
GROUP BY AGENTID)) D
WHERE TM1.TERMINALID =D.AGENTID(+)) T,
(SELECT TM.TERMINALID, DECODE(AGENTSTATUS,'N',0,1) AS AGENT_STATUS
FROM (SELECT TERMINALID
FROM FS_FR_TERMINALMASTER )TM,
(SELECT AGENTID, PROPERTY_VALUE AS AGENTSTATUS
FROM FS_FR_AGENTHISTORY
WHERE PROPERTY_NAME ='AGENT_STATUS'
AND PROPERTY_DATE IN(SELECT MAX(PROPERTY_DATE) FROM FS_FR_AGENTHISTORY
WHERE PROPERTY_NAME ='AGENT_STATUS' GROUP BY AGENTID))B
WHERE SUBSTR(tm.TERMINALID,0,3)=AGENTID(+)) A
WHERE T.TERMINALID= A.TERMINALID
UNION
(SELECT GATEWAYID TERMIANLID, 1 STATUS, '111111' SHIPMENTTYPE
FROM FS_FR_GATEWAYMASTER
WHERE GATEWAYID NOT IN (SELECT TERMINALID FROM FS_FR_TERMINALMASTER ));
Explain Plan :-
SELECT STATEMENT, GOAL = ALL_ROWS Cost=38 Cardinality=927
SORT UNIQUE Cost=38 Cardinality=927
UNION-ALL
HASH JOIN RIGHT OUTER Cost=32 Cardinality=925
VIEW Object owner=EXPO0626 Cost=12 Cardinality=210
HASH JOIN Cost=12 Cardinality=210
VIEW Object owner=SYS Object name=VW_NSO_1 Cost=6 Cardinality=413
SORT GROUP BY Cost=6 Cardinality=413
TABLE ACCESS FULL Object owner=EXPO0626 Object name=FS_FR_AGENTHISTORY Cost=5 Cardinality=466
TABLE ACCESS FULL Object owner=EXPO0626 Object name=FS_FR_AGENTHISTORY Cost=5 Cardinality=466
NESTED LOOPS Cost=20 Cardinality=925
HASH JOIN RIGHT OUTER Cost=18 Cardinality=925
VIEW Object owner=EXPO0626 Cost=12 Cardinality=210
HASH JOIN Cost=12 Cardinality=210
VIEW Object owner=SYS Object name=VW_NSO_2 Cost=6 Cardinality=413
SORT GROUP BY Cost=6 Cardinality=413
TABLE ACCESS FULL Object owner=EXPO0626 Object name=FS_FR_AGENTHISTORY Cost=5 Cardinality=466
TABLE ACCESS FULL Object owner=EXPO0626 Object name=FS_FR_AGENTHISTORY Cost=5 Cardinality=466
TABLE ACCESS FULL Object owner=EXPO0626 Object name=FS_FR_TERMINALMASTER Cost=6 Cardinality=925
INDEX UNIQUE SCAN Object owner=EXPO0626 Object name=PK_TERM Cost=0 Cardinality=1
NESTED LOOPS ANTI Cost=4 Cardinality=2
INDEX FAST FULL SCAN Object owner=EXPO0626 Object name=SYS_C0054927 Cost=2 Cardinality=927
INDEX UNIQUE SCAN Object owner=EXPO0626 Object name=PK_TERM Cost=0 Cardinality=923
Regards,
Srinivas.Hi
explain plan SET STATEMENT_ID = 'VD20001' for < your query>
and then
SELECT * FROM TABLE(dbms_xplan.display('plan_table','VD20001','TYPICAL'));
why we need to set above statment and what do you mean by 'VD20001' and
how to read this plan generated by this statment "SELECT * FROM TABLE(dbms_xplan.display('plan_table','VD20001','TYPICAL'));" .
Below mentioned is the plan generated according to your commands.
SQL> select * from table(dbms_xplan.display('plan_table','VD20001','TYPICAL'));
| Id | Operation | Name | Rows |
Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 6 |
1068 | 76 (12)|
| 1 | SORT AGGREGATE | | 1 |
45 | |
|* 2 | TABLE ACCESS BY INDEX ROWID | FS_AC_INVOICEALLOCATION | 1 |
45 | 3 (0)|
|* 3 | INDEX RANGE SCAN | PK_INV_VOU_REF | 1 |
| 2 (0)|
| 4 | SORT AGGREGATE | | 1 |
45 | |
|* 5 | TABLE ACCESS BY INDEX ROWID | FS_AC_INVOICEALLOCATION | 1 |
45 | 3 (0)|
|* 6 | INDEX RANGE SCAN | PK_INV_VOU_REF | 1 |
| 2 (0)|
| 7 | SORT GROUP BY | | 6 |
1068 | 76 (12)|
| 8 | MERGE JOIN CARTESIAN | | 6 |
1068 | 74 (11)|
|* 9 | VIEW | FS_AC_AGEING_VIEW | 2 |
318 | 56 (4)|
| 10 | SORT UNIQUE | | 2 |
307 | 56 (43)|
| 11 | UNION-ALL | | |
| |
| 12 | NESTED LOOPS | | 1 |
178 | 32 (0)|
| 13 | NESTED LOOPS | | 4 |
536 | 27 (0)|
| 14 | MERGE JOIN CARTESIAN | | 3 |
219 | 18 (0)|
|* 15 | INDEX RANGE SCAN | FS_AC_COMPANYINFO_IDX_015 | 1 |
9 | 2 (0)|
| 16 | BUFFER SORT | | 1214 |
77696 | 16 (0)|
|* 17 | INDEX RANGE SCAN | FS_AC_ACCTMASTER_IDX_013 | 1214 |
77696 | 16 (0)|
| 18 | TABLE ACCESS BY INDEX ROWID| FS_AC_VOUCHERDTL | 1 |
61 | 3 (0)|
|* 19 | INDEX RANGE SCAN | FS_AC_VOUCHERDTL_IDX_016 | 1 |
| 2 (0)|
|* 20 | TABLE ACCESS BY INDEX ROWID | FS_AC_VOUCHERMASTER | 1 |
44 | 2 (0)|
|* 21 | INDEX UNIQUE SCAN | PK_VT_VN_BK | 1 |
| 1 (0)|
|* 22 | TABLE ACCESS BY INDEX ROWID | FS_AC_OPGBALDTL | 1 |
56 | 2 (0)|
| 23 | NESTED LOOPS | | 1 |
129 | 22 (0)|
| 24 | MERGE JOIN CARTESIAN | | 3 |
219 | 18 (0)|
|* 25 | INDEX RANGE SCAN | FS_AC_COMPANYINFO_IDX_015 | 1 |
9 | 2 (0)|
| 26 | BUFFER SORT | | 1214 |
77696 | 16 (0)|
|* 27 | INDEX RANGE SCAN | FS_AC_ACCTMASTER_IDX_013 | 1214 |
77696 | 16 (0)|
|* 28 | INDEX RANGE SCAN | PK_OPGBALDTL | 1 |
| 1 (0)|
|* 29 | INDEX RANGE SCAN | FS_AC_ACCTSUBGRP_IDX1 | 1 |
27 | 1 (0)|
| 30 | BUFFER SORT | | 3 |
57 | 75 (12)|
| 31 | VIEW | | 3 |
57 | 9 (34)|
| 32 | SORT UNIQUE | | 3 |
18 | 9 (78)|
| 33 | UNION-ALL | | |
| |
|* 34 | INDEX FAST FULL SCAN | SYS_C0054818 | 8 |
24 | 2 (0)|
|* 35 | INDEX FAST FULL SCAN | SYS_C0054818 | 7 |
21 | 2 (0)|
| 36 | TABLE ACCESS BY INDEX ROWID | FS_FR_CURRENCYMASTER | 1 |
12 | 2 (0)|
|* 37 | INDEX UNIQUE SCAN | SYS_C0054818 | 1 |
| 1 (0)|
Predicate Information (identified by operation id):
2 - filter(TRUNC("VOUCHERDATE")<SYSDATE@!)
3 - access("VOUCHERTYPE"=:B1 AND "VOUCHERNUMBER"=:B2 AND "ACCTCODE"=:B3 AND "
BOOKID"=:B4)
filter("ACCTCODE"=:B1 AND "BOOKID"=:B2)
5 - filter(TRUNC("VOUCHERDATE")<=SYSDATE@!)
6 - access("VOUCHERTYPE"=:B1 AND "VOUCHERNUMBER"=:B2 AND "ACCTCODE"=:B3 AND "
BOOKID"=:B4)
filter("ACCTCODE"=:B1 AND "BOOKID"=:B2)
9 - filter("A"."ACCTCODE" LIKE (SELECT "SUBGRPCODE" FROM "FS_AC_ACCTSUBGRPMA
STER"
"FS_AC_ACCTSUBGRPMASTER" WHERE "SUBGRPNAME"='LOCAL DEBTORS')||'AR%
15 - access("CI"."COMPANYID"='EXPMAA' AND "CI"."BOOKID"<=2)
filter("CI"."COMPANYID"='EXPMAA' AND "CI"."BOOKID"<=2)
17 - access("AM"."TERMINALID"='EXPMAA')
19 - access("AM"."ACCTCODE"="VD"."ACCTCODE" AND "VD"."BOOKID"<=2)
filter("VD"."BOOKID"<=2 AND ("VD"."ACCTCODE" LIKE '%AR_____' OR "VD"."ACC
TCODE" LIKE
'%AP_____') AND "BANKCASHPARTYCODEIND" NOT LIKE 'F%')
20 - filter("VM"."APPROVALSTATUS"='Y' AND TRUNC("VOUCHERDATE")<=SYSDATE@!)
21 - access("VM"."VOUCHERTYPE"="VD"."VOUCHERTYPE" AND
"VM"."VOUCHERNUMBER"="VD"."VOUCHERNUMBER" AND "VD"."BOOKID"="VM"."
BOOKID")
filter("VM"."BOOKID"<=2 AND "CI"."BOOKID"="VM"."BOOKID")
22 - filter("STATUS" NOT LIKE 'F%' AND TRUNC("DOCDATE")<=SYSDATE@!)
25 - access("CI"."COMPANYID"='EXPMAA' AND "CI"."BOOKID"<=2)
filter("CI"."COMPANYID"='EXPMAA' AND "CI"."BOOKID"<=2)
27 - access("AM"."TERMINALID"='EXPMAA')
28 - access("AM"."ACCTCODE"="OP"."ACCTCODE" AND "CI"."BOOKID"="OP"."BOOKID")
filter("OP"."BOOKID"<=2 AND ("OP"."ACCTCODE" LIKE '%AR_____' OR "OP"."ACC
TCODE" LIKE
'%AP_____'))
29 - access("SUBGRPNAME"='LOCAL DEBTORS')
34 - filter("CURRENCY1"='INR')
35 - filter("CURRENCY2"='INR')
37 - access("CURRENCY1"='INR' AND "CURRENCY2"='INR')
Note
- 'PLAN_TABLE' is old version
80 rows selected.
Regards,
Srinivas. -
Do i need to tune the redolog?
10g R2 on AIX 5.3L
this is a typical alert file about the redo log file switching of the day.
Mon May 28 01:26:33 2007
Thread 1 advanced to log sequence 24017
Current log# 4 seq# 24017 mem# 0: /u020/apps/oracle/oradata/BAAN/redo04.log
Mon May 28 08:04:13 2007
Thread 1 advanced to log sequence 24018
Current log# 5 seq# 24018 mem# 0: /u020/apps/oracle/oradata/BAAN/redo05.log
Mon May 28 08:05:56 2007
Thread 1 advanced to log sequence 24019
Current log# 3 seq# 24019 mem# 0: /u020/apps/oracle/oradata/BAAN/redo03.log
Mon May 28 08:07:29 2007
Thread 1 advanced to log sequence 24020
Current log# 2 seq# 24020 mem# 0: /u020/apps/oracle/oradata/BAAN/redo02.log
Mon May 28 08:08:55 2007
Thread 1 advanced to log sequence 24021
Current log# 1 seq# 24021 mem# 0: /u020/apps/oracle/oradata/BAAN/redo01.log
Mon May 28[b] 08:10:26 2007
Thread 1 advanced to log sequence 24022
Current log# 4 seq# 24022 mem# 0: /u020/apps/oracle/oradata/BAAN/redo04.log
Mon May 28 08:12:05 2007
Thread 1 advanced to log sequence 24023
Current log# 5 seq# 24023 mem# 0: /u020/apps/oracle/oradata/BAAN/redo05.log
Mon May 28 08:13:55 2007
Thread 1 advanced to log sequence 24024
Current log# 3 seq# 24024 mem# 0: /u020/apps/oracle/oradata/BAAN/redo03.log
Mon May 28 11:31:05 2007
Thread 1 advanced to log sequence 24025
Current log# 2 seq# 24025 mem# 0: /u020/apps/oracle/oradata/BAAN/redo02.log
Mon May 28 14:36:13 2007
Thread 1 advanced to log sequence 24026
Current log# 1 seq# 24026 mem# 0: /u020/apps/oracle/oradata/BAAN/redo01.log
Do I need to tune the redo log? Each of redo log file is 50MB. It switched more frequent when there are not many users than real busy hours.
nullSelect may or may not generate redo. Delayed block cleanout is one of the reasons for a query to produce redo: https://metalink.oracle.com/metalink/plsql/f?p=130:14:2631437878498686237::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,40689.1,1,1,1,helvetica#aref1
Another reason is locking the rows with "for update":
SQL> create table t1 as select * from all_objects;
Table created.
SQL> set autot trace stat
SQL> select * from t1;
39310 rows selected.
Statistics
0 recursive calls
0 db block gets
3117 consistent gets
538 physical reads
0 redo size
2524195 bytes sent via SQL*Net to client
18612 bytes received via SQL*Net from client
2622 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
39310 rows processed
SQL> select * from t1 for update;
39310 rows selected.
Statistics
24 recursive calls
40020 db block gets
43446 consistent gets
625 physical reads
7754052 redo size
3501635 bytes sent via SQL*Net to client
18612 bytes received via SQL*Net from client
2622 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
39310 rows processed -
I cannot get itunes to work/install on myPC. I am running windows 8 in a 64 bit machine. I also want to purchase books via itunes for my Nook. Are you deliberately excluding PC owners so we cannot use ituens on our computers???? I have selected a community but have no idea what community I should be working with. Can somone explai these communities to me? Also. you don't allow much time to go thru the sign up process. I had to start over SEVERAL times as you kept timing me out. Jesus...when people are signing up for the first time, we have no idea of the questions that will be asked. Give us a break and give us time to sign up. Not everone is disability free and able to go thru your process quickly...you are NOT user friendly. You should be for people who are wanting to join your community. I used to want an Apple product but now that I have had first hand experience with your web page, I think I will probably stay away from Apple products. VERY DISAPPOINTING
Jan 11, 2014 10:26 AM Re: I NEED I TUNES FOR A 64 BIT PC. OPERATING SYSTEM IS WINDOWS 8, NON TOUCH SCREEN. WHICH IS THE ABSOLUTELY BEST WAY TO GET ITUNES OPERATING CORRECTLY ON MY PC????//I HAVE TRIED SEVERAL THINGS, NONE OF WHICH ARE WORKING. IS ITUNES DELIBERATELY EXCLUDING
Re: I NEED I TUNES FOR A 64 BIT PC. OPERATING SYSTEM IS WINDOWS 8, NON TOUCH SCREEN. WHICH IS THE ABSOLUTELY BEST WAY TO GET ITUNES OPERATING CORRECTLY ON MY PC????//I HAVE TRIED SEVERAL THINGS, NONE OF WHICH ARE WORKING. IS ITUNES DELIBERATELY EXCLUDING PC'S in response to Birdlover1
Post over in the iTunes for Windows forum, here:
https://discussions.apple.com/community/itunes/itunes_for_windows
sebastian -
I'm trying to download the newest version of I tunes because I just got the I phone 5c..it wont download because I have to have I tunes 10.6.8 but it wont let me download that either because I need I tunes 10.6 to get it and I can't find that download anywhere..I need to get the book for school on my I pad or phone by tomorrow...what do I do?
Welcome to Apple Support Communities
The iPhone 5c needs iTunes 11.1, which requires Mac OS X 10.6.8. See if your Mac can be upgraded to Mac OS X Snow Leopard > http://support.apple.com/kb/sp575 If so, buy Mac OS X Snow Leopard > http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
Then, make a backup of your data with Time Machine or Disk Utility's Restore, insert the disc and follow its steps to upgrade to Mac OS X Snow Leopard. You shouldn't lose compatibility with any application. After upgrading, open > Software Update, and install the latest version. It will install iTunes 11.1, so you will be able to sync the iPhone 5c with your Mac -
Defining more parameters than a query needs
Hi.
When I run the following code, I get the error "ORA-01036: illegal variable name/number" .
The problem is that I currently define more parameters than the query needs. Thats because I don't know how many bind variables the query uses, and I would not like to parse the query ...
I don't understand why I have to define exactly the same number of parameters, and in the exact order ... It doesn't make sense. As bind variables have names, there should be no problem passing more parameters or parameters in a different order: the binding should be done by name...
I'm currently using Oracle10g, ODP.NET and .NET Framework 2.0.
I would appreciate any help ...
Thank you.
Ricardo Coimbras
===== BEGIN VB.NET CODE =====
Sub Execute_Query(ByVal SqlString as String)
Dim ObjCmd As OracleCommand
Dim DataAdap As OracleDataAdapter
Dim outDsCorpo As DataSet
Dim Constroi_Conn_String_Oracle As String
Dim mObjConnOracle As OracleConnection
Constroi_Conn_String_Oracle = "User ID=uuu" & _
";Password=ppp" & _
";Data Source=bd" & _
";Pooling=false"
mObjConnOracle = New OracleConnection(Constroi_Conn_String_Oracle)
mObjConnOracle.Open()
ObjCmd = mObjConnOracle.CreateCommand()
ObjCmd.CommandType = CommandType.Text
ObjCmd.CommandText = SqlString
ObjCmd.Parameters.Add("p1", OracleDbType.Char, 3, "001", ParameterDirection.Input)
ObjCmd.Parameters.Add("p2", OracleDbType.Char, 3, "001", ParameterDirection.Input)
DataAdap = New OracleDataAdapter(ObjCmd)
outDsCorpo = New DataSet()
DataAdap.Fill(outDsCorpo)
GridView1.DataSource = outDsCorpo
GridView1.DataBind()
DataAdap = Nothing
ObjCmd = Nothing
mObjConnOracle.Close()
mObjConnOracle.Dispose()
mObjConnOracle = Nothing
End Sub
Execute_Query "select * from map.t_mapa_def where mapa_def_cod = :p1 order by mapa_def_cod"
===== END VB.NET CODE =====Hi,
BindByPosition is the default behavior as per the docs, and you can change that by setting cmd.BindByName=true which adds a little bit of extra overhead.
That wont fix the error seen when binding a random number of parameters to the statement though. You need to bind the correct number and types of parameters.
Greg -
How much UNDO does a query need?
It seems that due to a gigantic delete, I am running out of UNDO. How can I see exactly how much undo a query needs?
Searching on the web, I found this:
select sq.sql_text sql_text, t.USED_UREC Records, t.USED_UBLK Blocks, (t.USED_UBLK*8192/1024) KBytes from v$transaction t,
v$session s,
v$sql sq
where t.addr = s.taddr
and s.sql_id = sq.sql_id
and s.username = 'blah'
, which is fine, but it seems to be returning results for only running queries. In other words, when the delete query I am investigating is executed, the above select returns no rows. Is there a way to modify it to return also queries that have been executed?
Any help is welcome.
Message was edited by:
user622271Hi,
It seems that you need to make an outer join between v$sql and v$session views [s.sql_id = sq.sql_id(+)] ... For more information is if this [url http://forums.oracle.com/forums/thread.jspa?messageID=1756927�]thread can help you.
Cheers
Legatti -
SQL query needed to identify cancelled invoice where distribution lines
SQL query needed to identify cancelled invoice where distribution lines Debit is not equal Credit line item in particular
Is there a way from back end FROM ap_invoice_distributions_all where we can find for the cancelled invoice where distribution lines Debit is not equal Credit line item
Regards,
Prakash RanjanHello Prakash
Can you please see if this query helps you?
SELECT i.invoice_id, i.invoice_amount, nvl(sum(d.amount),0)
FROM ap_invoice_distributions_all d, ap_invoices_all i
WHERE i.org_id = <you org_id>
AND i.invoice_id = d.invoice_id
AND d.line_type_lookup_code not in ('PREPAY')
AND i.cancelled_date IS NOT NULL
GROUP BY i.invoice_id, i.invoice_amount
HAVING (i.invoice_amount <> nvl(sum(d.amount),0))
ORDER BY i.invoice_id asc
Octavio -
Query to get list of employees having photo attached with their profile and query needed to extract the January to April timesheets approved in oracle on 6th May 2008
sorry could not understand your question completely.
I think following query should work, but I am not sure
select *
from hxc_time_building_blocks
where start_time >= sysdate - 60
and scope = 'APPLICATION_PERIOD'
and trunc(date_from) = trunc(sysdate)
and date_to = to_date('31-12-4712', 'DD-MM-YYYY')
and approval_status = 'APPROVED';
Change your date from sysdate to some other date. This query is not optimized so you need to tweak it a bit if it works at all.
Any other OTL Expert on this -
How to find which query need to tuned
Hi ,
How can i find , which query need to tuned . Is there any mechanism behind it?The mechanisms behind it are depending on your database version.
For example:
Oracle 9i has STATSPACK that helps you to identify possible problem queries.
Oracle 10g has AWR - Automatic Workload Repository
Oracle 11g has SPA - Database Replay SQL Performance Analyzer
but there are many more tools/mechanisms...trace/tkprof for example.
Go to http://tahiti.oracle.com and do a search on 'performance tuning guide', and pick the one that matches your (sofar unknown) database version, read a bit every now and then and see what tools are at your disposal and fit your requirement and situation.
Besides the links that Blu already posted, searches on http://asktom.oracle.com also give lots of pointers and explanations regarding the (neverending) tuning process (at least: helped me tremendously in understanding the tuning process, the do's and dont's).
Make sure you don't get CTD (Compulsive Tuning Disorder) from all this... ;) -
i need i tunes 10.5 for my i phone 4s and cant download onto 64 bit windows 7 laptop tried everything anyone help me please????
true. but he is right itunes automatically sees your running 64 bit and as soon as you go to the site on left hand side of sceen you see download 10.5 just click it and you should see this it automatically points to 64 bit install then you just hit download again. pretty simple
Tunes 10.5 for Windows (64-bit)
Email me New On iTunes and special iTunes offers.
Keep me up to date with Apple news, software updates, and the latest information on products and services.
then right below this it says download
or just click this link http://www.apple.com/itunes/download/ -
Hi ,
I had one ZEE program which has 25 files as input file (input data's . Here the logic of the program is as mention below.
1.initializition .
2.get_file_names.(All 25 files name is get in the same perform )
3.write_job_log.
4.open_files.(Open 25 files at a time )
5.read_surr_ctl_file.
6.load_internal_tabs.( Load 25 files data to ITAB )
7.create_edi214_tables.
8.process_ekko_ekpo.(Proces the ITAB data at the time.)
9.refresh_internal_tables.
Here they are openning 25 files , then loading all 25 files to ITAB and processing all the loaded datas.
When this progarm is schedule in background it takes 1.25 hrs to complete the process .
I need to tune this program which ever possible way.
My thought and analysis in this program is -> This performance problem is due to like openning 25 files , then loading all 25 files to ITAB and processing all the loaded datas which may hit the performance . Kindly let me know you IDEAS and experence on this issue . This program is having 10000 lines of code ..
Regards,
VeeraHi,
This program has a lot of steps and the best way to solve its performance problems is with SE30.
I think you should execute SE30 in development environment e check the steps where there is bad performance.
If you improve the performance in the development environment you will improve also in production environment.
Regards,
Fernando
Maybe you are looking for
-
Report definition for the report not specified
Hello I have written the code attached but getting the error "report definition for the report not specified" string v_report_name = Charts.ReportPermutation.ToString() + Charts.charttype + ".rdlc"; string v_report_server = "http://MANOJ
-
Defining Multiple Groups in PDF template
Hi, I am having trouble defining multiple groups in my pdf template. I would like to set up multiple groups for printing po data such as (G_LINES, G_SHIPMENTS, etc.) How is this done in Acrobat? I am using 7.0 Professional. I have created BODY START
-
Macbook Pro's display have weird lines
Hey everyone, I have a macbook pro (15-inch, Early 2011), sometimes horizontal and vertical lines randomly show up on my screen (photo below)! I' ve notice that happen when I have photoshop and illustrator opened. Is graphics card problem? Any though
-
ISync deleted a calendar from iCal
I'm very new to the Mac world. My PC died at Thanksgiving and I'm still getting used to my new iMac. I am using iSync to sync between my new iMac and my very old Handspring Visor Prism. Things are going remarkably well except now that I have moved al
-
Hi, I've got this issue on first launch of After Effects on Mac (mavericks). Nothing loads, just this error. I un-installed then re-installed and it still display this error. Any idea ?