Need to tune insert query
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
Similar Messages
-
Help needed to tune the Query:Statistics added
Can someone DBA please help me to tune this query:
SELECT DISTINCT K.ATTRIBUTE_VALUE AGENCY_ID,B.PROFILE_NM ,NVL(G.OFFICE_DESC,'--') OFFICE_DESC,f.OFFICE_ID,B.PROFILE_ID,'%' ROLE,'%' LAYOUT,
CASE
WHEN 'flagB' = '%' THEN
NVL(J.ISS_GRP_DESC,'BILLING')
WHEN 'flagO' = '%' THEN
NVL(J.ISS_GRP_DESC,'ORDERING')
WHEN 'flag' = '%' THEN
NVL(J.ISS_GRP_DESC,'BILLING/ORDERING')
ELSE
NVL(J.ISS_GRP_DESC,' ')
END ISS_GRP_DESC,
DECODE(NVL(H.USERID,' ') ,' ','--','<a sbcuid_in=' || H.USERID || ' target=NEW >'||H.FIRSTNAME || ' ' || H.LASTNAME || '( ' || H.USERID || ' )</a>' ) USER_NAME
FROM
PROFILE_PORTAL B ,
TBL_BDA_AGENCY_RESP_REP C ,
TBL_BDA_AGENCY_OFFICE F,
TBL_BDA_OFFICE G,
USERS_PORTAL H,
TBL_BDA_USR_ISS_GRP I ,
TBL_BDA_ISS_GROUP J,
ATTRIBUTE_VALUES_PORTAL K,
PROFILE_TYPE_PORTAL L
WHERE
B.PROFILE_ID = F.AGENCY_ID (+)
AND B.PROFILE_ID = C.AGENCY_ID (+)
AND G.OFFICE_ID (+)= F.OFFICE_ID
AND H.USERID (+)= C.RESP_USR_ID
AND C.ISS_GRP_ID = I.ISS_GRP_ID (+)
AND I.ISS_GRP_ID = J.ISS_GRP_ID(+)
AND 'PROFILE.'||B.PROFILE_ID = K.ENTITY_ID(+)
AND K.ATTRIBUTE_VALUE IS NOT NULL
AND L.PROFILE_TYPE_ID = B.PROFILE_TYPE_ID
AND L.APPLICATION_CD='BDA'
AND NOT EXISTS (SELECT agency_id
FROM TBL_BDA_AGENCY_RESP_REP t
WHERE t.ISS_GRP_ID IN ('%')
AND t.AGENCY_ID = C.AGENCY_ID)
AND K.ATTRIBUTE_VALUE LIKE '%'
AND UPPER(B.PROFILE_NM) LIKE UPPER('%')
AND (to_char(NVL(B.PROFILE_ID,0)) LIKE '%' OR NVL(B.PROFILE_ID,0) IN ('a'))
AND NVL(G.OFFICE_ID,0) IN ('%')
AND (to_char(NVL(C.RESP_USR_ID,'0')) LIKE '%' OR NVL(C.RESP_USR_ID,'0') IN ('k'))
ORDER BY PROFILE_NM
The number of rows in these tables are as follows:
PROFILE_PORTAL -- 2392
TBL_BDA_AGENCY_RESP_REP 3508
TBL_BDA_AGENCY_OFFICE 2151
TBL_BDA_OFFICE 3
USERS_PORTAL 270500
TBL_BDA_USR_ISS_GRP 234
TBL_BDA_ISS_GROUP 2
ATTRIBUTE_VALUES_PORTAL 2790
PROFILE_TYPE_PORTAL 3
The Explain pal nhas given this o/p to me:
SQL> select * from table(dbms_xplan.display) dual;
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost |
| 0 | SELECT STATEMENT | | 807 | 102K| | 2533 |
| 1 | SORT UNIQUE | | 807 | 102K| 232K| 82 |
|* 2 | FILTER | | | | | |
|* 3 | HASH JOIN OUTER | | 807 | 102K| | 52 |
|* 4 | HASH JOIN OUTER | | 807 | 95226 | | 40 |
|* 5 | TABLE ACCESS BY INDEX ROWID | ATTRIBUTE_VALUES | 1 | 23 | | 2 |
| 6 | NESTED LOOPS | | 7 | 805 | | 37 |
| 7 | NESTED LOOPS OUTER | | 6 | 552 | | 25 |
|* 8 | FILTER | | | | | |
| 9 | NESTED LOOPS OUTER | | | | | |
|* 10 | FILTER | | | | | |
| 11 | NESTED LOOPS OUTER | | | | | |
| 12 | NESTED LOOPS OUTER | | 3 | 141 | | 10 |
|* 13 | HASH JOIN | | 3 | 120 | | 7 |
|* 14 | TABLE ACCESS FULL | PROFILE | 6 | 198 | | 4 |
|* 15 | TABLE ACCESS FULL | PROFILE_TYPE | 1 | 7 | | 2 |
|* 16 | INDEX RANGE SCAN | SYS_C0019777 | 1 | 7 | | 1 |
| 17 | TABLE ACCESS BY INDEX ROWID| TBL_BDA_OFFICE | 1 | 10 | | 1 |
|* 18 | INDEX UNIQUE SCAN | SYS_C0019800 | 1 | | | |
| 19 | TABLE ACCESS BY INDEX ROWID | TBL_BDA_AGENCY_RESP_REP | 2 | 26 | | 2 |
|* 20 | INDEX RANGE SCAN | IDX_AGECYRESP_AGNCYID | 2 | | | 1 |
| 21 | TABLE ACCESS BY INDEX ROWID | USER_ | 1 | 22 | | 1 |
|* 22 | INDEX UNIQUE SCAN | USER_PK | 1 | | | |
|* 23 | INDEX RANGE SCAN | IDX_ATTVAL_ENTATTID | 1 | | | 1 |
| 24 | TABLE ACCESS FULL | TBL_BDA_USR_ISS_GRP | 234 | 702 | | 2 |
| 25 | TABLE ACCESS FULL | TBL_BDA_ISS_GROUP | 2 | 24 | | 2 |
|* 26 | TABLE ACCESS BY INDEX ROWID | TBL_BDA_AGENCY_RESP_REP | 1 | 7 | | 3 |
|* 27 | INDEX RANGE SCAN | IDX_AGECYRESP_AGNCYID | 2 | | | 1 |
Predicate Information (identified by operation id):
2 - filter( NOT EXISTS (SELECT /*+ */ 0 FROM "TBL_BDA_AGENCY_RESP_REP" "T" WHERE "T"."AGENCY_ID"=:B1
AND "T"."ISS_GRP_ID"=TO_NUMBER('%')))
3 - access("I"."ISS_GRP_ID"="J"."ISS_GRP_ID"(+))
4 - access("SYS_ALIAS_1"."ISS_GRP_ID"="I"."ISS_GRP_ID"(+))
5 - filter("K"."ATTRIBUTE_VALUE" IS NOT NULL AND "K"."ATTRIBUTE_VALUE" LIKE '%')
8 - filter(NVL("SYS_ALIAS_1"."RESP_USR_ID",'0') LIKE '%' OR NVL("SYS_ALIAS_1"."RESP_USR_ID",'0')='k')
10 - filter(NVL("G"."OFFICE_ID",0)=TO_NUMBER('%'))
13 - access("L"."PROFILE_TYPE_ID"="B"."PROFILE_TYPE_ID")
14 - filter(UPPER("B"."PROFILE_NM") LIKE '%' AND (TO_CHAR(NVL("B"."PROFILE_ID",0)) LIKE '%' OR
NVL("B"."PROFILE_ID",0)=TO_NUMBER('a')))
15 - filter("L"."APPLICATION_CD"='BDA')
16 - access("B"."PROFILE_ID"="F"."AGENCY_ID"(+))
18 - access("G"."OFFICE_ID"(+)="F"."OFFICE_ID")
20 - access("B"."PROFILE_ID"="SYS_ALIAS_1"."AGENCY_ID"(+))
22 - access("H"."USERID"(+)="SYS_ALIAS_1"."RESP_USR_ID")
23 - access("K"."ENTITY_ID"='PROFILE.'||TO_CHAR("B"."PROFILE_ID"))
26 - filter("T"."ISS_GRP_ID"=TO_NUMBER('%'))
27 - access("T"."AGENCY_ID"=:B1)
Note: cpu costing is off
57 rows selected.
Elapsed: 00:00:01.08
Please help me.
Aashish S.Hello Eric,
Here is the code:
SELECT DISTINCT
K.ATTRIBUTE_VALUE AGENCY_ID,
B.PROFILE_NM ,
NVL(G.OFFICE_DESC,'--') OFFICE_DESC,
f.OFFICE_ID,
B.PROFILE_ID,
'%' ROLE,
'%' LAYOUT,
case
WHEN 'flagB' = '%' THEN
NVL(J.ISS_GRP_DESC,'BILLING')
WHEN 'flagO' = '%' THEN
NVL(J.ISS_GRP_DESC,'ORDERING')
WHEN 'flag' = '%' THEN
NVL(J.ISS_GRP_DESC,'BILLING/ORDERING')
else
NVL(J.ISS_GRP_DESC,' ')
END ISS_GRP_DESC,
DECODE(NVL(H.USERID,' ') ,' ','--','<a sbcuid_in=' || H.USERID || ' target=NEW >'||H.FIRSTNAME || ' ' || H.LASTNAME ||
'( ' || H.USERID || ' )</a>' ) USER_NAME
from
PROFILE_PORTAL B ,
TBL_BDA_AGENCY_RESP_REP C ,
TBL_BDA_AGENCY_OFFICE F,
TBL_BDA_OFFICE G,
USERS_PORTAL H,
TBL_BDA_USR_ISS_GRP I ,
TBL_BDA_ISS_GROUP J,
ATTRIBUTE_VALUES_PORTAL K,
PROFILE_TYPE_PORTAL L
WHERE
B.PROFILE_ID = F.AGENCY_ID (+)
AND B.PROFILE_ID = C.AGENCY_ID (+)
AND G.OFFICE_ID (+)= F.OFFICE_ID
AND H.USERID (+)= C.RESP_USR_ID
AND C.ISS_GRP_ID = I.ISS_GRP_ID (+)
AND I.ISS_GRP_ID = J.ISS_GRP_ID(+)
AND 'PROFILE.'||B.PROFILE_ID = K.ENTITY_ID(+)
AND K.ATTRIBUTE_VALUE IS NOT NULL
AND L.PROFILE_TYPE_ID = B.PROFILE_TYPE_ID
AND L.APPLICATION_CD='BDA'
AND NOT EXISTS
(SELECT agency_id
FROM TBL_BDA_AGENCY_RESP_REP t
WHERE t.ISS_GRP_ID IN (1)
AND t.AGENCY_ID = C.AGENCY_ID)
AND K.ATTRIBUTE_VALUE LIKE '%'
AND UPPER(B.PROFILE_NM) LIKE UPPER('%')
AND (to_char(NVL(B.PROFILE_ID,0))
LIKE '%'
OR NVL(B.PROFILE_ID,0) IN (1))
AND NVL(G.OFFICE_ID,0) IN (1)
AND (to_char(NVL(C.RESP_USR_ID,'0'))
LIKE '%'
OR NVL(C.RESP_USR_ID,'0') IN ('%'))
ORDER BY PROFILE_NM
This is the Query and the query takes some mins. to run in prod environment.
From the Query plan ,I am not able to get any idea for optimization.
Now,Can you tell me which steps I need to follow to run it faster and which all modifications should be made?
Thanks.
Aashish S. -
Hi
I dont know anything about tuning
can anybody help to tune this query
SQL> set autotrace traceonly explain
SQL> select count(*) from ibs_x_t_receipts c
2 where exists
3 (Select 1 from ibs_s_i_doc_receipt a,ibs_x_t_bill b
4 where A.app_fr_doc_no = c.receipt_no
5 and a.app_to_doc_no = b.doc_no
6 and a.app_to_tr_type = 'TRN001'
7 and A.app_fr_tr_type = 'TRN002'
8 and b.bill_month <= '31-dec-2008'
9 and b.balance_ser_amt = 0
10 and b.balance_tax_amt = 0)
11 /
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=212880 Card=1 Byte
s=21)
1 0 SORT (AGGREGATE)
2 1 NESTED LOOPS (Cost=212880 Card=1 Bytes=21)
3 2 VIEW OF 'VW_SQ_1' (VIEW) (Cost=212878 Card=1 Bytes=14)
4 3 HASH (UNIQUE)
5 4 NESTED LOOPS
6 5 NESTED LOOPS (Cost=212878 Card=1 Bytes=66)
7 6 VIEW OF 'index$_join$_002' (VIEW) (Cost=30021
Card=91387 Bytes=3564093)
8 7 HASH JOIN
9 8 INDEX (RANGE SCAN) OF 'SIDOC_INDX1' (INDEX
) (Cost=171215 Card=91387 Bytes=3564093)
10 8 INDEX (RANGE SCAN) OF 'SIDOC_INDX2' (INDEX
) (Cost=366130 Card=91387 Bytes=3564093)
11 6 INDEX (UNIQUE SCAN) OF 'ITL_PK2' (INDEX (UNIQU
E)) (Cost=1 Card=1)
12 5 TABLE ACCESS (BY INDEX ROWID) OF 'IBS_X_T_BILL'
(TABLE) (Cost=2 Card=1 Bytes=27)
13 2 INDEX (UNIQUE SCAN) OF 'RECEIPTS_PK2' (INDEX (UNIQUE))
(Cost=1 Card=1 Bytes=7)it is running like anything, i didn't get the result.
Please help me
kanish--untested
SELECT COUNT (*)
FROM ibs_x_t_receipts c
WHERE EXISTS (
SELECT 1
FROM ibs_s_i_doc_receipt a
WHERE a.app_fr_doc_no = c.receipt_no
AND a.app_to_tr_type = 'TRN001'
AND a.app_fr_tr_type = 'TRN002'
AND EXISTS (
SELECT 1
FROM ibs_x_t_bill b
WHERE a.app_to_doc_no = b.doc_no
AND b.bill_month <= '31-dec-2008'
AND b.balance_ser_amt = 0
AND b.balance_tax_amt = 0))regards,
friend
Edited by: most wanted!!!! on Apr 17, 2012 3:51 AM -
Hi ,
I have a Query that needs to be tuned.
The query joins two views with some filter condition.
While running the individual view query with the filter condition i can able to get the results quickly within a seconds.
But while joining the views conditions of the same criteria which i have used for the individual query takes more than 30 minute.
i am struggling to tuning this query which was written using the views.
Note :
My problem is while checking the explain plan unique sort is taking more cost.
is that i can reduce the time by giving some optimizer hints to reduce the unique sort cost for query using views?
Thanks & regards,
Senthur pandi MHi,
BluShadow wrote:
957595 wrote:
Hi ,
I have a Query that needs to be tuned.
The query joins two views with some filter condition.
While running the individual view query with the filter condition i can able to get the results quickly within a seconds.
But while joining the views conditions of the same criteria which i have used for the individual query takes more than 30 minute.
i am struggling to tuning this query which was written using the views.
Note :
My problem is while checking the explain plan unique sort is taking more cost.Cost in not necessarily a good comparison to use. The cost is a figure determined on a per-query basis,The problem with cost is that it's a prediction made by the optimizer, rather than the actual measure of query performance. Optimizer often makes mistakes about expected query performance. Ironically, people normally look at query cost when it needs tuning, i.e. when the chance that optimizer made a mistake is especially high.
In many internet forums one can see claims that cost estimates are meaningless across different queries. Such claims are unfounded. When calculated correctly, cost is quite meaningful, and in such cases there is nothing wrong about comparing cost not only for different queries, but also for different databases (if they have same optimizer settings and system stats).
is that i can reduce the time by giving some optimizer hints to reduce the unique sort cost for query using views?Hints are not the way to improve performance. That's an overstatement. The sad truth is that in many cases there is no viable alternative to using hints. Rather than always avoid hints no matter what cost, it's better to understand how hints affect optimizer behavior, and when it's safe to use them.
They are great for identifying where the cause of a performance issue is, but shouldn't be used in production code, as it would be like saying that you know better than Oracle how to retrieve the data, not just now, but in the future as more
data is added and as data is deleted and replaced with new data etc. By adding hints you are effectively forcing the optimizer to execute the query in a particular way, which may be fast now, but in the future may be worse than what the optimizer can determine itself.Hints that force the optimizer to use a specific access path or a specific join method are dangerous -- because the only lock-in one part of the plan, but not the entire plan (e.g. INDEX hint only ensures that an index is used if possible, but it cannot ensure INDEX UNIQUE/RANGE SCAN, so you may end up in a situation when the optimizer is doing an expensive and meaningless INDEX FULL SCAN because of the hint that was indended to force a different, more selective, access method).
Hints that don't do that, but rather prevent the optimizer from trying to be smart when it's better to keep things simple, are relatively safe.
So, use the hints to identify where there are issues in the SQL or in the database design, and fix those issues, rather than leave hints in production code.As a general rule, sure. Here, however, the problem seems to be obvious -- if views are fast separately, and slow when joined, that suggests that the optimizer doesn't merge them correctly.
Best regards,
Nikolay -
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 All,
I need to tune the query which is taking more than 1 hour to execute over 8 Lakhs of record.
SQL> explain plan for SELECT C.aci_cust_code cust_code,
2 C.aci_cust_name cust_name,
3 R.NAME ruledefination,
4 B.RULECODE ALERTS,
5 A.custom1 tran_id,
6 TD_get_value('AMLTRANTYPE', RTRIM(A.custom17)) trantype,
7 A.CUSTOM18 tran_nature,
8 A.custom25 tran_date,
9 A.messageno messageno,
10 TD_get_value('AMLTRANSTATUS', A.status) msgstatus,
11 D.acai_acct_type acct_type,
12 A.custom19 acct_number,
13 A.CURRENCY CURRENCY,
14 A.priorityamount amount,
15 A.operator USERNAME,
16 A.msgdb_id msgdb_id,
17 A.msg_mode_in msg_mode_in
18 FROM MSGDB A,
19 MSGALERTS B,
20 AML_CUST_INFO C,
21 AML_CUST_ACC_INFO D,
22 RULETBL2 R,
23 (SELECT tdkey FROM tabledetails WHERE tdidcode = 'AML-INCLUDEQ' ) amlqueues
24 WHERE A.msgdb_id = B.msgdb_id AND
25 A.queueid = amlqueues.tdkey AND
26 A.MSG_MODE_IN = 'AML-TRANS' AND
27 A.custom15 = C.aci_cust_code AND
28 A.CUSTOM19=D.ACAI_ACCT_NUMBER(+) AND
29 TO_CHAR(A.custom25,'YYYYMMDD') BETWEEN
30 TO_CHAR(TO_DATE('2011/01/01','YYYY/MM/DD'),'YYYYMMDD')
31 AND TO_CHAR(TO_DATE('2011/01/31','YYYY/MM/DD'),'YYYYMMDD')
32 AND B.RULECODE = R.RULECODE
33 ORDER BY A.custom25, msgdb_id,B.rulecode;
Explained.
PLAN_TABLE_OUTPUT
Plan hash value: 1081661146
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 173K| 30M| | 12697 (2)| 00:02:33 |
| 1 | SORT ORDER BY | | 173K| 30M| 66M| 12697 (2)| 00:02:33 |
|* 2 | HASH JOIN | | 173K| 30M| | 5580 (4)| 00:01:07 |
| 3 | VIEW | index$_join$_005 | 3395 | 81480 | | 42 (3)| 00:00:01 |
|* 4 | HASH JOIN | | | | | | |
| 5 | INDEX FAST FULL SCAN | IDX_RCODE | 3395 | 81480 | | 10 (0)| 00:00:01 |
| 6 | INDEX FAST FULL SCAN | SYS_C0040836 | 3395 | 81480 | | 31 (0)| 00:00:01 |
|* 7 | HASH JOIN | | 1737 | 276K| | 5534 (4)| 00:01:07 |
|* 8 | HASH JOIN | | 559 | 86645 | | 4575 (3)| 00:00:55 |
|* 9 | HASH JOIN OUTER | | 448 | 56000 | | 4463 (3)| 00:00:54 |
| 10 | NESTED LOOPS | | 448 | 47040 | | 4404 (3)| 00:00:53 |
|* 11 | TABLE ACCESS BY INDEX ROWID| MSGDB | 451 | 35178 | | 4403 (3)| 00:00:53 |
|* 12 | INDEX RANGE SCAN | I_MODEDATE | 2292 | | | 4323 (3)| 00:00:52 |
|* 13 | INDEX UNIQUE SCAN | PK_TABLEDETAIL | 1 | 27 | | 0 (0)| 00:00:01 |
| 14 | INDEX FAST FULL SCAN | ACC_NUMBER_TYPE | 58947 | 1151K| | 58 (4)| 00:00:01 |
| 15 | TABLE ACCESS FULL | AML_CUST_INFO | 18340 | 537K| | 111 (1)| 00:00:02 |
| 16 | TABLE ACCESS FULL | MSGALERTS | 868K| 6782K| | 944 (4)| 00:00:12 |
There is no index on RULECODE of MSGALERTS and RULETBL2 table.
Could yu guys guide me how to tune this query with or without creating any new index.
Thanks,To emphasise what hoek has said regarding dates, NEVER compare dates with dates by converting them to strings (or numbers). By doing so, you remove vital information from the optimizer.
For example, what is the difference between "31st Dec 2010" and "1st Jan 2011"? Easy, they're dates, that's 1 day.
But what's the difference between "20101231" and "20110101"? Easy: 20110101 - 20101231 = 8870.
That makes the difference between the optimizer guessing 1 row or 8870 rows... a fairly big difference, I think you'll agree, which could well impact on the plan the optimizer chooses.
One other point - leaving the clause as dates gives:
AND a.custom25 BETWEEN TO_DATE('2011/01/01', 'YYYY/MM/DD')
AND TO_DATE('2011/01/31', 'YYYY/MM/DD') which excludes any dates on 31st Jan 2011 except midnight, eg. 10am on 31st Jan 2011 won't be returned by your query.
If you're after rows for a given month, then you could do:
AND trunc(a.custom25, 'mm') = TO_DATE('01/01/2011', 'dd/mm/yyyy') -
Need help in insert statment query
Hi,
I have a table T1 with values like
col1
1
2
3
4
I need to write insert statment for t2 as
insert into t2(col1,col2) values ('AA',select col1 from t1);
The output of T2 should be
col1 col2
AA 1
AA 2
AA 3
AA 4
Any help in modifying the query.
AshishWhat is wrong with this?
INSERT INTO id_own_dw.id_t_dw_org_dq_tgt
(cost_center_cod_vc_old,
cost_center_cod_vc_new
SELECT '3016052',<<<_-- this you can replace with your varibale in pl/sql block
cost_center_cod_vc
FROM id_own_dw.id_t_dw_msl_org_cctr2mkdiv
WHERE busi_unit_cod_vc = '3016496' -
Hi,
PLease help me to tune the query
select primary_rep,
rep_ssn,
nvl(product_type_desc, 'UNKNOWN') as productName,
ROUND(sum(contributions)) as contribution,
ROUND(sum(withdrawls)) as withdrawls,
ROUND(sum(netflow)) as netflow
from dev.NETFLOW_VIEW_TSS_P
where bd = 'TSS'
and actvtydate between '01-Jan-2011' and '30-Sep-2011'
and rep_ssn IN (select tax_id from broker_view where broker_id = '600468')
group by primary_rep, rep_ssn, nvl(product_type_desc, 'UNKNOWN');
explain plan details below
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 79 | 158K| | 74348 (1)| 00:14:53 | | |
| 1 | HASH GROUP BY | | 79 | 158K| | 74348 (1)| 00:14:53 | | |
|* 2 | HASH JOIN | | 79 | 158K| | 74347 (1)| 00:14:53 | | |
| 3 | VIEW | VW_NSO_1 | 1 | 6 | | 18 (17)| 00:00:01 | | |
| 4 | HASH UNIQUE | | 1 | 100 | | 18 (17)| 00:00:01 | | |
| 5 | NESTED LOOPS OUTER | | 1 | 100 | | 17 (12)| 00:00:01 | | |
| 6 | MERGE JOIN CARTESIAN | | 1 | 92 | | 17 (12)| 00:00:01 | | |
| 7 | NESTED LOOPS OUTER | | 1 | 71 | | 15 (14)| 00:00:01 | | |
| 8 | NESTED LOOPS OUTER | | 1 | 67 | | 12 (17)| 00:00:01 | | |
|* 9 | HASH JOIN OUTER | | 1 | 63 | | 10 (20)| 00:00:01 | | |
| 10 | NESTED LOOPS OUTER | | 1 | 56 | | 6 (0)| 00:00:01 | | |
| 11 | NESTED LOOPS OUTER | | 1 | 52 | | 4 (0)| 00:00:01 | | |
| 12 | TABLE ACCESS BY INDEX ROWID | AFFILIATE | 1 | 45 | | 2 (0)| 00:00:01 | | |
|* 13 | INDEX UNIQUE SCAN | AFFILIATE_PK | 1 | | | 1 (0)| 00:00:01 | | |
|* 14 | TABLE ACCESS FULL | PORTAL_BROKER | 1 | 7 | | 2 (0)| 00:00:01 | | |
| 15 | VIEW PUSHED PREDICATE | | 1 | 4 | | 2 (0)| 00:00:01 | | |
| 16 | NESTED LOOPS | | 1 | 28 | | 2 (0)| 00:00:01 | | |
| 17 | NESTED LOOPS | | 1 | 21 | | 2 (0)| 00:00:01 | | |
|* 18 | TABLE ACCESS BY INDEX ROWID | LOCATION_GROUP_TYPE_DESC | 1 | 5 | | 1 (0)| 00:00:01 | | |
|* 19 | INDEX UNIQUE SCAN | LOCATION_GROUP_TYPE_DESC_PK | 1 | | | 0 (0)| 00:00:01 | | |
|* 20 | INDEX RANGE SCAN | LOCATION_GROUP_UK | 1 | 16 | | 1 (0)| 00:00:01 | | |
|* 21 | INDEX UNIQUE SCAN | CONTACT_METHOD_PK | 1 | 7 | | 0 (0)| 00:00:01 | | |
| 22 | VIEW | | 1 | 7 | | 3 (34)| 00:00:01 | | |
| 23 | HASH UNIQUE | | 1 | 11 | | 3 (34)| 00:00:01 | | |
|* 24 | INDEX RANGE SCAN | AFFILIATE_TYPE_PK | 1 | 11 | | 2 (0)| 00:00:01 | | |
| 25 | VIEW PUSHED PREDICATE | | 1 | 4 | | 2 (0)| 00:00:01 | | |
| 26 | NESTED LOOPS | | 1 | 28 | | 2 (0)| 00:00:01 | | |
| 27 | NESTED LOOPS | | 1 | 21 | | 2 (0)| 00:00:01 | | |
|* 28 | TABLE ACCESS BY INDEX ROWID | LOCATION_GROUP_TYPE_DESC | 1 | 5 | | 1 (0)| 00:00:01 | | |
|* 29 | INDEX UNIQUE SCAN | LOCATION_GROUP_TYPE_DESC_PK | 1 | | | 0 (0)| 00:00:01 | | |
|* 30 | INDEX RANGE SCAN | LOCATION_GROUP_UK | 1 | 16 | | 1 (0)| 00:00:01 | | |
|* 31 | INDEX UNIQUE SCAN | CONTACT_METHOD_PK | 1 | 7 | | 0 (0)| 00:00:01 | | |
| 32 | VIEW PUSHED PREDICATE | | 1 | 4 | | 3 (0)| 00:00:01 | | |
| 33 | NESTED LOOPS OUTER | | 1 | 35 | | 3 (0)| 00:00:01 | | |
| 34 | NESTED LOOPS | | 1 | 32 | | 3 (0)| 00:00:01 | | |
| 35 | NESTED LOOPS | | 1 | 22 | | 2 (0)| 00:00:01 | | |
|* 36 | TABLE ACCESS BY INDEX ROWID | LOCATION_GROUP_TYPE_DESC | 1 | 5 | | 1 (0)| 00:00:01 | | |
|* 37 | INDEX UNIQUE SCAN | LOCATION_GROUP_TYPE_DESC_PK | 1 | | | 0 (0)| 00:00:01 | | |
|* 38 | INDEX RANGE SCAN | LOCATION_GROUP_UK | 1 | 17 | | 1 (0)| 00:00:01 | | |
| 39 | TABLE ACCESS BY INDEX ROWID | ADDRESS | 1 | 10 | | 1 (0)| 00:00:01 | | |
|* 40 | INDEX UNIQUE SCAN | ADDRESS_PK | 1 | | | 0 (0)| 00:00:01 | | |
|* 41 | INDEX UNIQUE SCAN | PROV_STDSC_PK | 1 | 3 | | 0 (0)| 00:00:01 | | |
| 42 | BUFFER SORT | | 1 | 21 | | 14 (15)| 00:00:01 | | |
|* 43 | INDEX RANGE SCAN | I_BROKER_BKBRCMB | 1 | 21 | | 2 (0)| 00:00:01 | | |
|* 44 | INDEX UNIQUE SCAN | BROKER_BRANCH_PK | 1 | 8 | | 0 (0)| 00:00:01 | | |
| 45 | VIEW | NETFLOW_VIEW_TSS_P | 391K| 766M| | 74325 (1)| 00:14:52 | | |
| 46 | UNION-ALL | | | | | | | | |
|* 47 | HASH JOIN RIGHT OUTER | | 11645 | 1671K| | 49023 (1)| 00:09:49 | | |
| 48 | VIEW | | 1 | 38 | | 13602 (1)| 00:02:44 | | |
|* 49 | FILTER | | | | | | | | |
| 50 | TABLE ACCESS FULL | SALES_REPORT_REP_MAPPING | 9023 | 326K| | 58 (2)| 00:00:01 | | |
|* 51 | FILTER | | | | | | | | |
| 52 | SORT GROUP BY NOSORT | | 1 | 11 | | 3 (0)| 00:00:01 | | |
| 53 | TABLE ACCESS BY INDEX ROWID | SALES_REPORT_REP_MAPPING | 1 | 11 | | 3 (0)| 00:00:01 | | |
|* 54 | INDEX RANGE SCAN | I_SAL_REP_MAP_REPID | 1 | | | 2 (0)| 00:00:01 | | |
| 55 | NESTED LOOPS | | 11645 | 1239K| | 35420 (1)| 00:07:06 | | |
|* 56 | HASH JOIN RIGHT OUTER | | 11645 | 898K| | 12112 (1)| 00:02:26 | | |
| 57 | INDEX FAST FULL SCAN | I_VENDORS_ACCTLOC | 986 | 3944 | | 2 (0)| 00:00:01 | | |
|* 58 | HASH JOIN RIGHT OUTER | | 11645 | 852K| | 12109 (1)| 00:02:26 | | |
|* 59 | MAT_VIEW ACCESS FULL | SECS_DESC | 26777 | 418K| | 3082 (1)| 00:00:37 | | |
|* 60 | FILTER | | | | | | | | |
|* 61 | HASH JOIN RIGHT OUTER | | 11645 | 670K| | 9026 (1)| 00:01:49 | | |
| 62 | MAT_VIEW ACCESS FULL | ENTRYCODES | 1640 | 11480 | | 8 (0)| 00:00:01 | | |
|* 63 | HASH JOIN | | 34936 | 1774K| | 9017 (1)| 00:01:49 | | |
|* 64 | INDEX FULL SCAN | I_CODE | 30 | 420 | | 1 (0)| 00:00:01 | | |
| 65 | PARTITION RANGE ALL | | 342K| 12M| | 9013 (1)| 00:01:49 | 1 | 20 |
| 66 | TABLE ACCESS BY LOCAL INDEX ROWID| BKPG | 342K| 12M| | 9013 (1)| 00:01:49 | 1 | 20 |
|* 67 | INDEX RANGE SCAN | I_BKPG_ACT_REC_IDX | 342K| | | 1412 (1)| 00:00:17 | 1 | 20 |
| 68 | TABLE ACCESS BY INDEX ROWID | ACCT_CUBE | 1 | 30 | | 2 (0)| 00:00:01 | | |
|* 69 | INDEX UNIQUE SCAN | ACCT_CUBE_PK | 1 | | | 1 (0)| 00:00:01 | | |
|* 70 | HASH JOIN RIGHT OUTER | | 379K| 52M| | 25303 (1)| 00:05:04 | | |
| 71 | VIEW | | 1 | 38 | | 13602 (1)| 00:02:44 | | |
|* 72 | FILTER | | | | | | | | |
| 73 | TABLE ACCESS FULL | SALES_REPORT_REP_MAPPING | 9023 | 326K| | 58 (2)| 00:00:01 | | |
|* 74 | FILTER | | | | | | | | |
| 75 | SORT GROUP BY NOSORT | | 1 | 11 | | 3 (0)| 00:00:01 | | |
| 76 | TABLE ACCESS BY INDEX ROWID | SALES_REPORT_REP_MAPPING | 1 | 11 | | 3 (0)| 00:00:01 | | |
|* 77 | INDEX RANGE SCAN | I_SAL_REP_MAP_REPID | 1 | | | 2 (0)| 00:00:01 | | |
|* 78 | HASH JOIN | | 379K| 39M| 33M| 11696 (2)| 00:02:21 | | |
|* 79 | HASH JOIN | | 379K| 28M| | 3210 (2)| 00:00:39 | | |
|* 80 | INDEX FAST FULL SCAN | I_VENDORS_ACCTLOC | 986 | 3944 | | 2 (0)| 00:00:01 | | |
|* 81 | HASH JOIN | | 379K| 27M| 14M| 3204 (2)| 00:00:39 | | |
| 82 | INDEX FAST FULL SCAN | SECS_DESC_PK | 744K| 6545K| | 457 (3)| 00:00:06 | | |
|* 83 | FILTER | | | | | | | | |
|* 84 | HASH JOIN RIGHT OUTER | | 379K| 24M| | 569 (3)| 00:00:07 | | |
| 85 | MAT_VIEW ACCESS FULL | MFENTRYCODES | 6853 | 61677 | | 15 (0)| 00:00:01 | | |
| 86 | PARTITION RANGE ALL | | 1138K| 62M| | 542 (1)| 00:00:07 | 1 | 15 |
|* 87 | TABLE ACCESS BY LOCAL INDEX ROWID | MFBKPG | 1138K| 62M| | 542 (1)| 00:00:07 | 1 | 15 |
|* 88 | INDEX RANGE SCAN | I_MFBKPGP_ACTDT_ACCT_TST | 904 | | | 107 (0)| 00:00:02 | 1 | 15 |
| 89 | INDEX FAST FULL SCAN | I_ACCT_CUBE_REPID_MKT | 1952K| 52M| | 3096 (2)| 00:00:38 | | |
Predicate Information (identified by operation id):
2 - access("REP_SSN"="$nso_col_1")
9 - access("A"."AFFILIATE_ID"="MGR"."AFFILIATE_ID"(+))
13 - access("A"."AFFILIATE_ID"='600468')
14 - filter("PORTAL_BROKER"."BROKER_ID"(+)='600468')
18 - filter("LT"."ADDRESS_CONTACT_IND"='C')
19 - access("LT"."LOCATION_GROUP_TYPE_CODE"='WF')
20 - access("L"."LOCATION_GROUP_TYPE_CODE"='WF' AND "L"."AFFILIATE_ID"="A"."AFFILIATE_ID")
filter("L"."CONTACT_METHOD_ID" IS NOT NULL)
21 - access("L"."CONTACT_METHOD_ID"="B"."CONTACT_METHOD_ID")
24 - access("AFFILIATE_ID"='600468')
filter("AFFILIATE_TYPE"='BBE' OR "AFFILIATE_TYPE"='BRM' OR "AFFILIATE_TYPE"='ISP')
28 - filter("LT"."ADDRESS_CONTACT_IND"='C')
29 - access("LT"."LOCATION_GROUP_TYPE_CODE"='WT')
30 - access("L"."LOCATION_GROUP_TYPE_CODE"='WT' AND "L"."AFFILIATE_ID"="A"."AFFILIATE_ID")
filter("L"."CONTACT_METHOD_ID" IS NOT NULL)
31 - access("L"."CONTACT_METHOD_ID"="B"."CONTACT_METHOD_ID")
36 - filter("LT"."ADDRESS_CONTACT_IND"='A')
37 - access("LT"."LOCATION_GROUP_TYPE_CODE"='WM')
38 - access("L"."LOCATION_GROUP_TYPE_CODE"='WM' AND "L"."AFFILIATE_ID"="A"."AFFILIATE_ID")
filter("L"."ADDRESS_ID" IS NOT NULL)
40 - access("L"."ADDRESS_ID"="A"."ADDRESS_ID")
41 - access("A"."PROVINCE_STATE_CODE"="S"."PROVINCE_STATE_CODE"(+))
43 - access("B"."BROKER_ID"='600468')
44 - access("B"."BRANCH_ID"="BR"."BRANCH_ID"(+))
47 - access("B"."REPID"="K"."REPID"(+))
49 - filter( EXISTS (SELECT 0 FROM DEV."SALES_REPORT_REP_MAPPING" "SALES_REPORT_REP_MAPPING" WHERE "REPID"=:B1 GROUP BY "REPID" HAVING
SUM(NVL("PCT",100))=100))
51 - filter(SUM(NVL("PCT",100))=100)
54 - access("REPID"=:B1)
56 - access(NVL("V"."VENDOR_CD"(+),'xxx')=NVL("VENDOR_CD",'yyy'))
58 - access("CUSIP"(+)="A"."CUSIP")
59 - filter("COMM_SECTYPE"(+)='MF')
60 - filter(NVL("Z"."PERF_INCLUDE_PORTFOLIO",'xx')='Y')
61 - access("A"."ENTRYCODE"="Z"."ENTRYCODE"(+))
63 - access("CODE_IN"=SUBSTR("A"."ACCT",1,3))
64 - access("CODE_TYPE"='NETFLOW')
filter("CODE_TYPE"='NETFLOW')
67 - access("A"."ACTVTYDATE">=TO_DATE(' 2011-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "A"."ACTVTYDATE"<=TO_DATE(' 2011-09-30
00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
69 - access("B"."ACCOUNTKEY"='11,,,'||"A"."ACCT")
70 - access("A"."REPID"="K"."REPID"(+))
72 - filter( EXISTS (SELECT 0 FROM DEV."SALES_REPORT_REP_MAPPING" "SALES_REPORT_REP_MAPPING" WHERE "REPID"=:B1 GROUP BY "REPID" HAVING
SUM(NVL("PCT",100))=100))
74 - filter(SUM(NVL("PCT",100))=100)
77 - access("REPID"=:B1)
78 - access("A"."ACCOUNTKEY"='20,'||"B"."VENDOR_CD"||','||"B"."FUNDNO"||','||"B"."ACCT")
79 - access("V"."VENDOR_CD"="B"."VENDOR_CD")
80 - filter("V"."VENDOR_CD"<>'HNR' AND "V"."VENDOR_CD"<>'CNL' AND "V"."VENDOR_CD"<>'IRE' AND "V"."VENDOR_CD"<>'WLR' AND
"V"."VENDOR_CD"<>'WLP' AND "V"."VENDOR_CD"<>'PER' AND "V"."VENDOR_CD"<>'BHV')
81 - access("SD"."CUSIP"="B"."CUSIP")
83 - filter(NVL("E"."PERF_INCLUDE_PORTFOLIO",'xx')='Y')
84 - access("B"."ENTRYCODE"="E"."ENTRYCODE"(+))
87 - filter("B"."VENDOR_CD"<>'HNR' AND "B"."VENDOR_CD"<>'CNL' AND "B"."VENDOR_CD"<>'IRE' AND "B"."VENDOR_CD"<>'WLR' AND
"B"."VENDOR_CD"<>'WLP' AND "B"."VENDOR_CD"<>'PER' AND "B"."VENDOR_CD"<>'BHV')
88 - access(SYS_OP_DESCEND("ACTVTYDATE")>=HEXTORAW('8790F6E1FEF8FEFAFF') AND SYS_OP_DESCEND("ACTVTYDATE")<=HEXTORAW('8790FEF8FEF8FEFAFF')
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("ACTVTYDATE"))>=TO_DATE(' 2011-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
SYS_OP_UNDESCEND(SYS_OP_DESCEND("ACTVTYDATE"))<=TO_DATE(' 2011-09-30 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
158 rows selected.ThanksSo this is a VIEW with I think 18 tables (I may have missed one or two), some of which are referenced more than one. Some of these tables have tens of miilions of rows. What exactly are you expecting from us?
I guess this is a data warehouse or BI query. Sometimes such queries just take an age to run and there's nothing which can be done except result caching. Other times the queries can be tuned, but iit requires way more context and domain knowledge than you have provided.
Please start by reading [url https://forums.oracle.com/forums/thread.jspa?threadID=2174552#9360003]this FAQ. .
Cheers, APC -
How to increase the performance of an insert query?
Hi,
I am using oracle database for our application where we executes one insert query and need the performance of 300 insert queries to be executed per second.
As of now we are getting only 30/sec.We are not knowing how to tune the database for getting this performance.
we are doing all this though C programming under both linux and solaris environment.
Can u guide me in this issue.
Regards,
vamsi krishnaPerformance tuning issue is not something you can get a straight forward answer for.
You need to look at various aspects of the system to get close to or increase the performance of your application. Tuning just the database might not give you want you want.
So, you need to look at the Application codes, Mermory, Disk IO, etc. Have a look at the Performance Tuning Guide from the Oracle Documentation Library for your Oracle Release and Operating System
http://www.oracle.com/technology/documentation/index.html#previous -
Help needed to optimize the query
Help needed to optimize the query:
The requirement is to select the record with max eff_date from HIST_TBL and that max eff_date should be > = '01-Jan-2007'.
This is having high cost and taking around 15mins to execute.
Can anyone help to fine-tune this??
SELECT c.H_SEC,
c.S_PAID,
c.H_PAID,
table_c.EFF_DATE
FROM MTCH_TBL c
LEFT OUTER JOIN
(SELECT b.SEC_ALIAS,
b.EFF_DATE,
b.INSTANCE
FROM HIST_TBL b
WHERE b.EFF_DATE =
(SELECT MAX (b2.EFF_DATE)
FROM HIST_TBL b2
WHERE b.SEC_ALIAS = b2.SEC_ALIAS
AND b.INSTANCE =
b2.INSTANCE
AND b2.EFF_DATE >= '01-Jan-2007')
OR b.EFF_DATE IS NULL) table_c
ON table_c.SEC_ALIAS=c.H_SEC
AND table_c.INSTANCE = 100;To start with, I would avoid scanning HIST_TBL twice.
Try this
select c.h_sec
, c.s_paid
, c.h_paid
, table_c.eff_date
from mtch_tbl c
left
join (
select sec_alias
, eff_date
, instance
from (
select sec_alias
, eff_date
, instance
, max(eff_date) over(partition by sec_alias, instance) max_eff_date
from hist_tbl b
where eff_date >= to_date('01-jan-2007', 'dd-mon-yyyy')
or eff_date is null
where eff_date = max_eff_date
or eff_date is null
) table_c
on table_c.sec_alias = c.h_sec
and table_c.instance = 100; -
Need help with INSERT and WITH clause
I wrote sql statement which correctly work, but how i use this statment with INSERT query? NEED HELP. when i wrote insert i see error "ORA 32034: unsupported use of with clause"
with t1 as(
select a.budat,a.monat as period,b.vtweg,
c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
c.wrbtr,
c.matnr,
c.menge,
a.monat,
c.zuonr
from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='D'
and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
,t2 as(
select a.BUKRS,a.BELNR, a.GJAHR,t1.vtweg,t1.budat,t1.monat from t1, ldw_v1.bkpf a
where t1.zuonr=a.xblnr and a.blart='WL' and bukrs='8431'
,tcogs as (
select t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
sum(bseg.wrbtr) as COGS,bseg.matnr,bseg.kunnr,sum(bseg.menge) as QUANTITY
from t2, ldw_v1.bseg
where t2.bukrs=bseg.bukrs and t2.belnr=bseg.BELNR and t2.gjahr=bseg.gjahr and BSEG.KOART='S'
group by t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
bseg.matnr,bseg.kunnr
,t3 as
select a.budat,a.monat,b.vtweg,
c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
case when c.shkzg='S' then c.wrbtr*(-1)
else c.wrbtr end as NTS,
c.matnr,c.kunnr,
c.menge*(-1) as Quantity
from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='S'
and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
,trevenue as (
select t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,
sum(t3.NTS) as NTS,t3.matnr,t3.kunnr,sum(t3.QUANTITY) as QUANTITY
from t3
group by t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,t3.matnr,t3.kunnr
select NVL(tr.budat,tc.budat) as budat,
NVL(tr.monat,tc.monat) as monat,
NVL(tr.vtweg,tc.vtweg) as vtweg,
NVL(tr.gjahr, tc.gjahr) as gjahr,
tr.hkont as NTS_hkont,
tc.hkont as COGS_hkont,
NVL(tr.prctr,tc.prctr) as prctr,
NVL(tr.MATNR, tc.MATNR) as matnr,
NVL(tr.kunnr, tc.kunnr) as kunnr,
NVL(tr.Quantity, tc.Quantity) as Quantity,
tr.NTS as NTS,
tc.COGS as COGS
from trevenue TR full outer join tcogs TC
on TR.BUDAT=TC.BUDAT and TR.MONAT=TC.MONAT and TR.GJAHR=TC.GJAHR
and TR.MATNR=TC.MATNR and TR.KUNNR=TC.KUNNR and TR.QUANTITY=TC.QUANTITY
and TR.VTWEG=TC.VTWEG and TR.PRCTR=TC.PRCTR
Edited by: user13566113 on 25.03.2011 5:26Without seeing what you tried it is hard to say what you did wrong, but this is how it would work
SQL> create table t ( n number );
Table created.
SQL> insert into t
2 with test_data as
3 (select 1 x from dual union all
4 select 2 x from dual union all
5 select 3 x from dual union all
6 select 4 x from dual)
7 select x from test_data;
4 rows created.
SQL> -
I need to pass a query in form of string to DBMS_XMLQUERY.GETXML package...the parameters to the query are date and varchar ..please help me build the string .Below is the query and the out put. ( the string is building fine except the parameters are with out quotes)
here is the procedure
create or replace
procedure temp(
P_MTR_ID VARCHAR2,
P_FROM_DATE IN DATE ,
P_THROUGH_DATE IN DATE ) AS
L_XML CLOB;
l_query VARCHAR2(2000);
BEGIN
l_query:= 'SELECT
a.s_datetime DATETIME,
a.downdate Ending_date,
a.downtime Ending_time,
TO_CHAR(ROUND(a.downusage,3),''9999999.000'') kWh_Usage,
TO_CHAR(ROUND(a.downcost,2),''$9,999,999.00'') kWh_cost,
TO_CHAR(ROUND(B.DOWNUSAGE,3),''9999999.000'') KVARH
FROM
(SELECT s_datetime + .000011574 s_datetime,
TO_CHAR(S_DATETIME ,''mm/dd/yyyy'') DOWNDATE,
DECODE(TO_CHAR(s_datetime+.000011574 ,''hh24:'
||'mi''), ''00:'
||'00'',''24:'
||'00'', TO_CHAR(s_datetime+.000011574,''hh24:'
||'mi'')) downtime,
s_usage downusage,
s_cost downcost
FROM summary_qtrhour
WHERE s_mtrid = '
||P_MTR_ID||
' AND s_mtrch = ''1''
AND s_datetime BETWEEN TO_DATE('
||P_FROM_DATE||
',''DD-MON-YY'') AND (TO_DATE('
||P_THROUGH_DATE||
',''DD-MON-YY'') + 1)
) a,
(SELECT s_datetime + .000011574 s_datetime,
s_usage downusage
FROM summary_qtrhour
WHERE s_mtrid = '
||P_MTR_ID||
' AND s_mtrch = ''2''
AND s_datetime BETWEEN TO_DATE('
||P_FROM_DATE||
',''DD-MON-YY'') AND (TO_DATE('
||P_THROUGH_DATE||
','' DD-MON-YY'') + 1)
) B
where a.S_DATETIME = B.S_DATETIME(+)';
SELECT DBMS_XMLQUERY.GETXML('L_QUERY') INTO L_XML FROM DUAL;
INSERT INTO NK VALUES (L_XML);
DBMS_OUTPUT.PUT_LINE('L_QUERY IS :'||L_QUERY);
END;
OUTPUT parameters are in bold (the issue is they are coming without single quotes otherwise th equery is fine
L_QUERY IS :SELECT
a.s_datetime DATETIME,
a.downdate Ending_date,
a.downtime Ending_time,
TO_CHAR(ROUND(a.downusage,3),'9999999.000') kWh_Usage,
TO_CHAR(ROUND(a.downcost,2),'$9,999,999.00') kWh_cost,
TO_CHAR(ROUND(B.DOWNUSAGE,3),'9999999.000') KVARH
FROM
(SELECT s_datetime + .000011574 s_datetime,
TO_CHAR(S_DATETIME ,'mm/dd/yyyy') DOWNDATE,
DECODE(TO_CHAR(s_datetime+.000011574 ,'hh24:mi'), '00:00','24:00', TO_CHAR(s_datetime+.000011574,'hh24:mi')) downtime,
s_usage downusage,
s_cost downcost
FROM summary_qtrhour
WHERE s_mtrid = N3165 AND s_mtrch = '1'
AND s_datetime BETWEEN TO_DATE(01-JAN-13,'DD-MON-YY') AND (TO_DATE(31-JAN-13,'DD-MON-YY') + 1)
) a,
(SELECT s_datetime + .000011574 s_datetime,
s_usage downusage
FROM summary_qtrhour
WHERE s_mtrid = N3165 AND s_mtrch = '2'
AND s_datetime BETWEEN TO_DATE(01-JAN-13,'DD-MON-YY') AND (TO_DATE(31-JAN-13,' DD-MON-YY') + 1)
) B
where a.S_DATETIME = B.S_DATETIME(+)The correct way to handle this is to use bind variables.
And use DBMS_XMLGEN instead of DBMS_XMLQUERY :
create or replace procedure temp (
p_mtr_id in varchar2
, p_from_date in date
, p_through_date in date
is
l_xml CLOB;
l_query VARCHAR2(2000);
l_ctx dbms_xmlgen.ctxHandle;
begin
l_query:= 'SELECT
a.s_datetime DATETIME,
a.downdate Ending_date,
a.downtime Ending_time,
TO_CHAR(ROUND(a.downusage,3),''9999999.000'') kWh_Usage,
TO_CHAR(ROUND(a.downcost,2),''$9,999,999.00'') kWh_cost,
TO_CHAR(ROUND(B.DOWNUSAGE,3),''9999999.000'') KVARH
FROM
(SELECT s_datetime + .000011574 s_datetime,
TO_CHAR(S_DATETIME ,''mm/dd/yyyy'') DOWNDATE,
DECODE(TO_CHAR(s_datetime+.000011574 ,''hh24:'
||'mi''), ''00:'
||'00'',''24:'
||'00'', TO_CHAR(s_datetime+.000011574,''hh24:'
||'mi'')) downtime,
s_usage downusage,
s_cost downcost
FROM summary_qtrhour
WHERE s_mtrid = :P_MTR_ID
AND s_mtrch = ''1''
AND s_datetime BETWEEN TO_DATE(:P_FROM_DATE,''DD-MON-YY'')
AND (TO_DATE(:P_THROUGH_DATE,''DD-MON-YY'') + 1)
) a,
(SELECT s_datetime + .000011574 s_datetime,
s_usage downusage
FROM summary_qtrhour
WHERE s_mtrid = :P_MTR_ID
AND s_mtrch = ''2''
AND s_datetime BETWEEN TO_DATE(:P_FROM_DATE,''DD-MON-YY'')
AND (TO_DATE(:P_THROUGH_DATE,'' DD-MON-YY'') + 1)
) B
where a.S_DATETIME = B.S_DATETIME(+)';
l_ctx := dbms_xmlgen.newContext(l_query);
dbms_xmlgen.setBindValue(l_ctx, 'P_MTR_ID', p_mtr_id);
dbms_xmlgen.setBindValue(l_ctx, 'P_FROM_DATE', to_char(p_from_date, 'DD-MON-YY'));
dbms_xmlgen.setBindValue(l_ctx, 'P_THROUGH_DATE', to_char(p_through_date, 'DD-MON-YY'));
l_xml := dbms_xmlgen.getXML(l_ctx);
dbms_xmlgen.closeContext(l_ctx);
insert into nk values (l_xml);
end; -
Hi,
I need some help in performing tuning of a big query. Explain plan is as under:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
Edited by: AbdulHadi on Sep 16, 2011 3:56 PM
Edited by: AHadi on Sep 19, 2011 10:02 AM3 SORT GROUP BY 47916 25M 491G 15M (3) 17:30:31
4 VIEW 870M 445G 15M (2) 17:24:08
5 HASH GROUP BY 870M 427G 885G 15M (2) 17:24:08
In above steps its using very high temporary tablespace usage. please try to tune your query.
- dynamic sampling used for this statement
The statistics appears to be stale. -
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 -
Performance issue with insert query !
Hi ,
I am using dbxml-2.4.16, my node-storage container is loaded with a large document ( 54MB xml ).
My document basically contains around 65k records in the same table ( 65k child nodes for one parent node ). I need to insert more records in to my DB, my insert XQuery is consuming a lot of time ( ~23 sec ) to insert one entry through command-line and around 50sec through code.
My container is indexed with "node-attribute-equality-string". The insert query I used:
insert nodes <NS:sampleEntry mySSIAddress='70011' modifier = 'create'><NS:sampleIPZone1Address>AABBCCDD</NS:sampleIPZone1Address><NS:myICMPFlag>1</NS:myICMPFlag><NS:myIngressFilter>1</NS:myIngressFilter><NS:myReadyTimer>4</NS:myReadyTimer><NS:myAPNNetworkID>ggsntest</NS:myAPNNetworkID><NS:myVPLMNFlag>2</NS:myVPLMNFlag><NS:myDAC>100</NS:myDAC><NS:myBcastLLIFlag>2</NS:myBcastLLIFlag><NS:sampleIPZone2Address>00000000</NS:sampleIPZone2Address><NS:sampleIPZone3Address>00000000</NS:sampleIPZone3Address><NS:sampleIPZone4Address>00000000</NS:sampleIPZone4Address><NS:sampleIPZone5Address>00000000</NS:sampleIPZone5Address><NS:sampleIPZone6Address>00000000</NS:sampleIPZone6Address><NS:sampleIPZone7Address>00000000</NS:sampleIPZone7Address></NS:sampleEntry> into doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:NS//NS:sampleTable)
If I modify my query with
into doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:sampleTable/NS:sampleEntry[@mySSIAddress='1']
insted of
into doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:NS//NS:sampleTable)
Time taken reduces only by 8 secs.
I have also tried to use insert "after", "before", "as first", "as last" , but there is no difference in performance.
Is anything wrong with my query, what should be the expected time to insert one record in a DB of 65k records.
Has anybody got any idea regarding this performance issue.
Kindly help me out.
Thanks,
Kapil.Hi George,
Thanks for your reply.
Here is the info you requested,
dbxml> listIndexes
Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2002/dbxml}:name
Index: node-attribute-equality-string for node {}:mySSIAddress
2 indexes found.
dbxml> info
Version: Oracle: Berkeley DB XML 2.4.16: (October 21, 2008)
Berkeley DB 4.6.21: (September 27, 2007)
Default container name: n_b_i_f_c_a_z.dbxml
Type of default container: NodeContainer
Index Nodes: on
Shell and XmlManager state:
Not transactional
Verbose: on
Query context state: LiveValues,Eager
The insery query with update takes ~32 sec ( shown below )
time query "declare namespace foo='MY-SAMPLE';declare namespace NS='NS';insert nodes <NS:sampleEntry mySSIAddress='70000' modifier = 'create' ><NS:sampleIPZone1Address>AABBCCDD</NS:sampleIPZone1Address><NS:myICMPFlag>1</NS:myICMPFlag><NS:myIngressFilter>1</NS:myIngressFilter><NS:myReadyTimer>4</NS:myReadyTimer><NS:myAPNNetworkID>ggsntest</NS:myAPNNetworkID><NS:myVPLMNFlag>2</NS:myVPLMNFlag><NS:myDAC>100</NS:myDAC><NS:myBcastLLIFlag>2</NS:myBcastLLIFlag><NS:sampleIPZone2Address>00000000</NS:sampleIPZone2Address><NS:sampleIPZone3Address>00000000</NS:sampleIPZone3Address><NS:sampleIPZone4Address>00000000</NS:sampleIPZone4Address><NS:sampleIPZone5Address>00000000</NS:sampleIPZone5Address><NS:sampleIPZone6Address>00000000</NS:sampleIPZone6Address><NS:sampleIPZone7Address>00000000</NS:sampleIPZone7Address></NS:sampleEntry> into doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:NS//NS:sampleTable"
Time in seconds for command 'query': 32.5002
and the query without the updation part takes ~14 sec ( shown below )
time query "declare namespace foo='MY-SAMPLE';declare namespace NS='NS'; doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:NS//NS:sampleTable"
Time in seconds for command 'query': 13.7289
The query :
time query "declare namespace foo='MY-SAMPLE';declare namespace NS='NS'; doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//PMB:sampleTable/PMB:sampleEntry[@mySSIAddress='1000']"
Time in seconds for command 'query': 0.005375
is very fast.
The Updation of the document seems to consume much of the time.
Regards,
Kapil.
Maybe you are looking for
-
Adobe acrobat 9.3.2 crashes when accessing Suntrust Mortgage statement
I am using the latest Acrobat reader. I have reinstalled it numerous times, and tried opening these documents on another computer using Adobe acrobat 9 Pro. I am using Windows 7 Ultimate 64 bits. In the end I had to download Foxit, which reads the do
-
How to find the Latency time in java.
How to find the Latency time in java.
-
Does skype run through safari?
Hiya, I'm really not technically minded so please bare with me! My parents are going on a cruise to the Caribbean from the UK and we were trying to work out the best way to keep in touch. So me and my dad (we both have iphone 4's) have down loaded th
-
What is Report Document Format?
Hi, I have seen "Report Document Format" in many Oracle Report Developer's job adverts. Following is an example. "Skills & Experience Required, Oracle Reports Developer - expert level, Report Document Format (RDF) - must have extensive knowledge in t
-
Dear All, Our customer need to export files to wordl and PDF. What should be the path of the folders in General Settings? I cannot see any folder I can use in B1_SHR. Should I use a local folder or a share folder? Thanks. Regards Yuka