Query taking time to execute
Hello,
i have created one query based on inventory cube 0IC_C03. when i am executing the infocube based on a particular date i am able to see the output but when i am executing the query on the basis of that particular date given while executing the cube the query is taking long time to execute and throwing a message of time limit exceed.
could anyone suggest me why the query is showing such nessage along with resolution.
Thanks,
Kumkum
Edited by: kumkum basu on Nov 29, 2010 2:33 PM
Hi,
There can be number of reason.
What you can do is:-
put the unwanted characteristics in Free Characteristics
Remove unwanted cell reference
Try using partitions in cubes
Use aggregates for summarised data.
f the above options doesnt work, then try pre-caching.This will definitely help!
Use proper selections to get small subset of data.
Goto RSRT>> type your query name>> Query properties>> select cache mode=4
In addition to RSRT, ST05 (sql trace), SE30 (runtime analysis) and system statistics (ST03) may help you in identifying performance issues with a report.
Thanks,.
Saveen Kumar
Similar Messages
-
I am creating a jsp application . . . .I am retreiving some values from my database oracle 10g..my query taking time to execute even in isql plus..am uisng tomcat5 and oracle 10gR2..can anyone pls tell me why it happens...my query fetches data from four tables...i dont know exactly why its taking so muc time say 50seconds...when i run the application in my local host it retrievs fast when i do that in server it creates a problem..
Actually it works fine when i deployed in my client server it takes time sometimes it takes atmost one minute
1.pls tell me how can i test my query about the performance
2.is der any command in oracle to test
3.how much bytes it takesLook at this thread...
When your query takes too long ... -
We have this query which is taking a long time to execute. From the explain plan what i found out is there is a full table scan going on W_GL_OTHER_F. Please help in identifying the problem area and solutions.
The query is,
select D1.c1 as c1,
D1.c2 as c2,
D1.c3 as c3,
D1.c4 as c4,
D1.c5 as c5,
D1.c6 as c6,
D1.c7 as c7,
D1.c8 as c8
from
(select distinct D1.c2 as c1,
D1.c3 as c2,
D1.c4 as c3,
D1.c5 as c4,
D1.c6 as c5,
D1.c7 as c6,
D1.c8 as c7,
D1.c1 as c8,
D1.c5 as c9
from
(select sum(case when T324628.OTHER_DOC_AMT is null then 0 else T324628.OTHER_DOC_AMT end ) as c1,
T91397.GL_ACCOUNT_NUM as c2,
T149255.SEGMENT_VAL_CODE as c3,
T148908.SEGMENT_VAL_DESC as c4,
T148543.HIER4_CODE as c5,
T148543.HIER4_NAME as c6,
T91707.ACCT_DOC_NUM as c7,
T91707.X_LINE_DESCRIPTION as c8
from
W_GL_OTHER_F T91707 /* Fact_W_GL_OTHER_F */ ,
W_GL_ACCOUNT_D T91397 /* Dim_W_GL_ACCOUNT_D */ ,
W_STATUS_D T96094 /* Dim_W_STATUS_D_Generic */ ,
WC_GL_OTHER_F_MV T324628 /* Fact_WC_GL_OTHER_MV */ ,
W_GL_SEGMENT_D T149255 /* Dim_W_GL_SEGMENT_D_Segment1 */ ,
W_GL_SEGMENT_D T148937 /* Dim_W_GL_SEGMENT_D_Segment3 */ ,
W_HIERARCHY_D T148543 /* Dim_W_HIERARCHY_D_Segment3 */ ,
W_GL_SEGMENT_D T148908 /* Dim_W_GL_SEGMENT_D_Segment2 */
where ( T91397.ROW_WID = T91707.GL_ACCOUNT_WID and T91707.DOC_STATUS_WID = T96094.ROW_WID and T96094.ROW_WID = T324628.DOC_STATUS_WID and T148543.HIER_CODE = T148937.SEGMENT_LOV_ID and T148543.HIER20_CODE = T148937.SEGMENT_VAL_CODE and T324628.DELETE_FLG = 'N' and T324628.X_CURRENCY_CODE = 'CAD' and T148543.HIER4_CODE <> '00000000000' and T91397.RECON_TYPE_CODE is not null and T91397.ROW_WID = T324628.GL_ACCOUNT_WID and T91397.ACCOUNT_SEG3_CODE = T148937.SEGMENT_VAL_CODE and T91397.ACCOUNT_SEG3_ATTRIB = T148937.SEGMENT_LOV_ID and T91397.ACCOUNT_SEG2_CODE = T148908.SEGMENT_VAL_CODE and T91397.ACCOUNT_SEG2_ATTRIB = T148908.SEGMENT_LOV_ID and T91397.ACCOUNT_SEG1_CODE = T149255.SEGMENT_VAL_CODE and T91397.ACCOUNT_SEG1_ATTRIB = T149255.SEGMENT_LOV_ID and (T96094.W_STATUS_CODE in ('POSTED', 'REVERSED')) and T91397.GL_ACCOUNT_NUM like '%98%' )
group by T91397.GL_ACCOUNT_NUM, T91707.ACCT_DOC_NUM, T91707.X_LINE_DESCRIPTION, T148543.HIER4_CODE, T148543.HIER4_NAME, T148908.SEGMENT_VAL_DESC, T149255.SEGMENT_VAL_CODE
) D1
) D1
order by c1, c2, c3, c4, c5, c6, c7The plan is,
PLAN_TABLE_OUTPUT
Plan hash value: 3196636288
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Psto
| 0 | SELECT STATEMENT | | 810K| 306M| | 266K (1)| 01:20:03 | | |
| 1 | HASH GROUP BY | | 810K| 306M| 320M| 266K (1)| 01:20:03 | | |
|* 2 | HASH JOIN | | 810K| 306M| 38M| 239K (1)| 01:11:56 | | |
|* 3 | MAT_VIEW ACCESS FULL | WC_GL_OTHER_F_MV | 1137K| 40M| | 9771 (2)| 00:0
|* 4 | HASH JOIN | | 531K| 189M| | 222K (1)| 01:06:38 | | |
| 5 | INLIST ITERATOR | | | | | | | | |
|* 6 | INDEX RANGE SCAN | W_STATUS_D_U2 | 4 | 56 | | 1 (0)| 00:00:01 |
|* 7 | HASH JOIN | | 607K| 208M| 8704K| 222K (1)| 01:06:38 | | |
|* 8 | HASH JOIN | | 40245 | 8214K| 2464K| 10843 (2)| 00:03:16 | | |
| 9 | VIEW | index$_join$_007 | 35148 | 2025K| | 122 (32)| 00:00:03 | |
|* 10 | HASH JOIN | | | | | | | | |
|* 11 | HASH JOIN | | | | | | | | |
|* 12 | HASH JOIN | | | | | | | | |
| 13 | BITMAP CONVERSION TO ROWIDS | | 35148 | 2025K| | 1 (0)| 00:00:01 | |
| 14 | BITMAP INDEX FULL SCAN | W_HIERARCHY_D_M2 | | | | | | |
| 15 | BITMAP CONVERSION TO ROWIDS | | 35148 | 2025K| | 24 (0)| 00:00:01 | |
| 16 | BITMAP INDEX FULL SCAN | W_HIERARCHY_D_M4 | | | | | | |
| 17 | BITMAP CONVERSION TO ROWIDS | | 35148 | 2025K| | 24 (0)| 00:00:01 | |
|* 18 | BITMAP INDEX FULL SCAN | X_W_HIERARCHY_D_M11 | | | | | | |
| 19 | BITMAP CONVERSION TO ROWIDS | | 35148 | 2025K| | 33 (0)| 00:00:01 | |
| 20 | BITMAP INDEX FULL SCAN | X_W_HIERARCHY_D_M12 | | | | | | |
|* 21 | HASH JOIN | | 40246 | 5895K| 4096K| 10430 (2)| 00:03:08 | |
| 22 | VIEW | index$_join$_008 | 65417 | 3321K| | 197 (14)| 00:00:04 |
|* 23 | HASH JOIN | | | | | | | | |
|* 24 | HASH JOIN | | | | | | | | |
| 25 | BITMAP CONVERSION TO ROWIDS | | 65417 | 3321K| | 3 (0)| 00:00:01 | |
| 26 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M1 | | | | | | |
| 27 | BITMAP CONVERSION TO ROWIDS | | 65417 | 3321K| | 66 (2)| 00:00:02 | |
| 28 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M2 | | | | | | |
| 29 | BITMAP CONVERSION TO ROWIDS | | 65417 | 3321K| | 100 (1)| 00:00:02 | |
| 30 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M3 | | | | | | |
|* 31 | HASH JOIN | | 40246 | 3851K| | 9953 (1)| 00:03:00 | | |
| 32 | VIEW | index$_join$_006 | 65417 | 1149K| | 82 (18)| 00:00:02 | |
|* 33 | HASH JOIN | | | | | | | | |
| 34 | BITMAP CONVERSION TO ROWIDS | | 65417 | 1149K| | 3 (0)| 00:00:01 | |
| 35 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M1 | | | | | | |
| 36 | BITMAP CONVERSION TO ROWIDS | | 65417 | 1149K| | 66 (2)| 00:00:02 | |
| 37 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M2 | | | | | | |
|* 38 | HASH JOIN | | 40246 | 3144K| | 9870 (1)| 00:02:58 | | |
| 39 | VIEW | index$_join$_005 | 65417 | 1149K| | 82 (18)| 00:00:02 | |
|* 40 | HASH JOIN | | | | | | | | |
| 41 | BITMAP CONVERSION TO ROWIDS| | 65417 | 1149K| | 3 (0)| 00:00:01 | |
| 42 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M1 | | | | | | |
| 43 | BITMAP CONVERSION TO ROWIDS| | 65417 | 1149K| | 66 (2)| 00:00:02 | |
| 44 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M2 | | | | | | |
|* 45 | TABLE ACCESS FULL | W_GL_ACCOUNT_D | 40246 | 2436K| | 9788 (1)| 00:02:57
| 46 | PARTITION RANGE ALL | | 11M| 4261M| | 152K (2)| 00:45:43 | 1 |1048
| 47 | TABLE ACCESS FULL | W_GL_OTHER_F | 11M| 4261M| | 152K (2)| 00:45:43
Predicate Information (identified by operation id):
2 - access("T96094"."ROW_WID"="T324628"."DOC_STATUS_WID" AND "T91397"."ROW_WID"="T324628"."GL_ACC
3 - filter("T324628"."X_CURRENCY_CODE"='CAD' AND "T324628"."DELETE_FLG"='N')
4 - access("T91707"."DOC_STATUS_WID"="T96094"."ROW_WID")
6 - access("T96094"."W_STATUS_CODE"='POSTED' OR "T96094"."W_STATUS_CODE"='REVERSED')
7 - access("T91397"."ROW_WID"="T91707"."GL_ACCOUNT_WID")
8 - access("T148543"."HIER_CODE"="T148937"."SEGMENT_LOV_ID" AND "T148543"."HIER20_CODE"="T148937"
10 - access(ROWID=ROWID)
11 - access(ROWID=ROWID)
12 - access(ROWID=ROWID)
18 - filter("T148543"."HIER4_CODE"<>'00000000000')
21 - access("T91397"."ACCOUNT_SEG2_CODE"="T148908"."SEGMENT_VAL_CODE" AND
"T91397"."ACCOUNT_SEG2_ATTRIB"="T148908"."SEGMENT_LOV_ID")
23 - access(ROWID=ROWID)
24 - access(ROWID=ROWID)
31 - access("T91397"."ACCOUNT_SEG3_CODE"="T148937"."SEGMENT_VAL_CODE" AND
"T91397"."ACCOUNT_SEG3_ATTRIB"="T148937"."SEGMENT_LOV_ID")
33 - access(ROWID=ROWID)
38 - access("T91397"."ACCOUNT_SEG1_CODE"="T149255"."SEGMENT_VAL_CODE" AND
"T91397"."ACCOUNT_SEG1_ATTRIB"="T149255"."SEGMENT_LOV_ID")
40 - access(ROWID=ROWID)
45 - filter("T91397"."GL_ACCOUNT_NUM" LIKE '%98%' AND "T91397"."RECON_TYPE_CODE" IS NOT NULL)
79 rows selected.user605926 wrote:
We have this query which is taking a long time to execute. From the explain plan what i found out is there is a full table scan going on W_GL_OTHER_F. Please help in identifying the problem area and solutions.
The plan is,
PLAN_TABLE_OUTPUT
Plan hash value: 3196636288
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Psto
| 0 | SELECT STATEMENT | | 810K| 306M| | 266K (1)| 01:20:03 | | |
| 1 | HASH GROUP BY | | 810K| 306M| 320M| 266K (1)| 01:20:03 | | |
|* 2 | HASH JOIN | | 810K| 306M| 38M| 239K (1)| 01:11:56 | | |
|* 3 | MAT_VIEW ACCESS FULL | WC_GL_OTHER_F_MV | 1137K| 40M| | 9771 (2)| 00:0
|* 4 | HASH JOIN | | 531K| 189M| | 222K (1)| 01:06:38 | | |
| 5 | INLIST ITERATOR | | | | | | | | |
|* 6 | INDEX RANGE SCAN | W_STATUS_D_U2 | 4 | 56 | | 1 (0)| 00:00:01 |
|* 7 | HASH JOIN | | 607K| 208M| 8704K| 222K (1)| 01:06:38 | | |
|* 8 | HASH JOIN | | 40245 | 8214K| 2464K| 10843 (2)| 00:03:16 | | |
| 9 | VIEW | index$_join$_007 | 35148 | 2025K| | 122 (32)| 00:00:03 | |
|* 10 | HASH JOIN | | | | | | | | |
|* 11 | HASH JOIN | | | | | | | | |
|* 12 | HASH JOIN | | | | | | | | |
| 13 | BITMAP CONVERSION TO ROWIDS | | 35148 | 2025K| | 1 (0)| 00:00:01 | |
| 14 | BITMAP INDEX FULL SCAN | W_HIERARCHY_D_M2 | | | | | | |
| 15 | BITMAP CONVERSION TO ROWIDS | | 35148 | 2025K| | 24 (0)| 00:00:01 | |
| 16 | BITMAP INDEX FULL SCAN | W_HIERARCHY_D_M4 | | | | | | |
| 17 | BITMAP CONVERSION TO ROWIDS | | 35148 | 2025K| | 24 (0)| 00:00:01 | |
|* 18 | BITMAP INDEX FULL SCAN | X_W_HIERARCHY_D_M11 | | | | | | |
| 19 | BITMAP CONVERSION TO ROWIDS | | 35148 | 2025K| | 33 (0)| 00:00:01 | |
| 20 | BITMAP INDEX FULL SCAN | X_W_HIERARCHY_D_M12 | | | | | | |
|* 21 | HASH JOIN | | 40246 | 5895K| 4096K| 10430 (2)| 00:03:08 | |
| 22 | VIEW | index$_join$_008 | 65417 | 3321K| | 197 (14)| 00:00:04 |
|* 23 | HASH JOIN | | | | | | | | |
|* 24 | HASH JOIN | | | | | | | | |
| 25 | BITMAP CONVERSION TO ROWIDS | | 65417 | 3321K| | 3 (0)| 00:00:01 | |
| 26 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M1 | | | | | | |
| 27 | BITMAP CONVERSION TO ROWIDS | | 65417 | 3321K| | 66 (2)| 00:00:02 | |
| 28 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M2 | | | | | | |
| 29 | BITMAP CONVERSION TO ROWIDS | | 65417 | 3321K| | 100 (1)| 00:00:02 | |
| 30 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M3 | | | | | | |
|* 31 | HASH JOIN | | 40246 | 3851K| | 9953 (1)| 00:03:00 | | |
| 32 | VIEW | index$_join$_006 | 65417 | 1149K| | 82 (18)| 00:00:02 | |
|* 33 | HASH JOIN | | | | | | | | |
| 34 | BITMAP CONVERSION TO ROWIDS | | 65417 | 1149K| | 3 (0)| 00:00:01 | |
| 35 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M1 | | | | | | |
| 36 | BITMAP CONVERSION TO ROWIDS | | 65417 | 1149K| | 66 (2)| 00:00:02 | |
| 37 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M2 | | | | | | |
|* 38 | HASH JOIN | | 40246 | 3144K| | 9870 (1)| 00:02:58 | | |
| 39 | VIEW | index$_join$_005 | 65417 | 1149K| | 82 (18)| 00:00:02 | |
|* 40 | HASH JOIN | | | | | | | | |
| 41 | BITMAP CONVERSION TO ROWIDS| | 65417 | 1149K| | 3 (0)| 00:00:01 | |
| 42 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M1 | | | | | | |
| 43 | BITMAP CONVERSION TO ROWIDS| | 65417 | 1149K| | 66 (2)| 00:00:02 | |
| 44 | BITMAP INDEX FULL SCAN | W_GL_SEGMENT_D_M2 | | | | | | |
|* 45 | TABLE ACCESS FULL | W_GL_ACCOUNT_D | 40246 | 2436K| | 9788 (1)| 00:02:57
| 46 | PARTITION RANGE ALL | | 11M| 4261M| | 152K (2)| 00:45:43 | 1 |1048
| 47 | TABLE ACCESS FULL | W_GL_OTHER_F | 11M| 4261M| | 152K (2)| 00:45:43
Predicate Information (identified by operation id):
2 - access("T96094"."ROW_WID"="T324628"."DOC_STATUS_WID" AND "T91397"."ROW_WID"="T324628"."GL_ACC
3 - filter("T324628"."X_CURRENCY_CODE"='CAD' AND "T324628"."DELETE_FLG"='N')
4 - access("T91707"."DOC_STATUS_WID"="T96094"."ROW_WID")
6 - access("T96094"."W_STATUS_CODE"='POSTED' OR "T96094"."W_STATUS_CODE"='REVERSED')
7 - access("T91397"."ROW_WID"="T91707"."GL_ACCOUNT_WID")
8 - access("T148543"."HIER_CODE"="T148937"."SEGMENT_LOV_ID" AND "T148543"."HIER20_CODE"="T148937"
10 - access(ROWID=ROWID)
11 - access(ROWID=ROWID)
12 - access(ROWID=ROWID)
18 - filter("T148543"."HIER4_CODE"<>'00000000000')
21 - access("T91397"."ACCOUNT_SEG2_CODE"="T148908"."SEGMENT_VAL_CODE" AND
"T91397"."ACCOUNT_SEG2_ATTRIB"="T148908"."SEGMENT_LOV_ID")
23 - access(ROWID=ROWID)
24 - access(ROWID=ROWID)
31 - access("T91397"."ACCOUNT_SEG3_CODE"="T148937"."SEGMENT_VAL_CODE" AND
"T91397"."ACCOUNT_SEG3_ATTRIB"="T148937"."SEGMENT_LOV_ID")
33 - access(ROWID=ROWID)
38 - access("T91397"."ACCOUNT_SEG1_CODE"="T149255"."SEGMENT_VAL_CODE" AND
"T91397"."ACCOUNT_SEG1_ATTRIB"="T149255"."SEGMENT_LOV_ID")
40 - access(ROWID=ROWID)
45 - filter("T91397"."GL_ACCOUNT_NUM" LIKE '%98%' AND "T91397"."RECON_TYPE_CODE" IS NOT NULL)
79 rows selected.
You may want to have a look at <a href="HOW TO: Post a SQL statement tuning request - template posting">HOW TO: Post a SQL statement tuning request - template posting</a> to see what more details are needed in order for somebody to provide better answer.
Based on what you have posted so far, you may want to share details of following questions (in addition to details in above link)
1) How much time does the query currently take to execute? How much time do you expect it to take? Also, how are you measuring query execution time?
2) Your plan suggests that the query is expected to return 810K rows. Is this figure close to actual number of records? What are you doing with this huge amount of data? -
Query taking 6mins to execute wityh order by clause, 3secs without orderby
Dear All,
The below query is taking nearly 6minutes time to execute (as i have order by clause in the query)
/* Formatted on 2007/09/26 10:03 (Formatter Plus v4.8.0) */
SELECT (SELECT DISTINCT grndate
FROM fs_lg_grnhdr
WHERE grnid = pl.grnid AND custwhid = pl.custwhid)
grndate,
pl.grnid,
(SELECT DISTINCT vi.orderno
FROM fs_lg_vendorinvoicehdr vi, fs_lg_grndtl gd
WHERE gd.vendorinvoiceid = vi.vendorinvoiceid
AND gd.custwhid = vi.custwhid
AND gd.custwhid = pl.custwhid
AND gd.grnid = pl.grnid
AND gd.partid = pl.partid) orderno,
pl.expirydate, pl.batchno, pl.packuom,
NVL (pl.receiptqty, 0) receiptqty, pl.putawayid, pl.lineno,
(SELECT customscontrolno
FROM fs_lg_putawaydtl
WHERE custwhid = pl.custwhid
AND putawayid = pl.putawayid
AND partid = pl.partid
AND locationto = pl.locationid) cctrlno,
(SELECT customspermitno
FROM fs_lg_putawayhdr
WHERE custwhid = pl.custwhid
AND putawayid = pl.putawayid) cpermitno,
(SELECT SUM (pdtl.pickqty)
FROM fs_lg_pickticketdtl pdtl,
fs_lg_picktickethdr phdr
WHERE pdtl.custwhid = pl.custwhid
AND pdtl.putawayid = pl.putawayid
AND pdtl.putawaylineno = pl.lineno
AND phdr.custwhid = pdtl.custwhid
AND phdr.pickticketid = pdtl.pickticketid
AND phdr.pickdate < '01-SEP-2007'
AND pdtl.status = 'CM') previousoutqty,
(SELECT SUM (pdtl.pickqty)
FROM fs_lg_pickticketdtl pdtl,
fs_lg_picktickethdr phdr
WHERE pdtl.custwhid = pl.custwhid
AND pdtl.putawayid = pl.putawayid
AND pdtl.putawaylineno = pl.lineno
AND phdr.custwhid = pdtl.custwhid
AND phdr.pickticketid = pdtl.pickticketid
AND phdr.pickdate BETWEEN '01-SEP-2007'
AND '25-SEP-2007'
AND pdtl.status = 'CM') presentoutqty,
NVL ((SELECT SUM (qty)
FROM fs_lg_internaltransdtl
WHERE putawayid = pl.putawayid
AND fromputawaylineno = pl.lineno
AND custwhid = pl.custwhid),
0
) toistqty,
NVL ((SELECT SUM (qty)
FROM fs_lg_internaltransdtl
WHERE custwhid = pl.custwhid
AND putawayid = pl.putawayid
AND slno = pl.lineno),
0
) fromistqty
FROM fs_lg_partloads pl
WHERE pl.partid = '2ERCH-2022'
AND pl.custwhid = 'RNH-CSM'
AND inventoryflag IN ('AVAIL','')
AND pl.status = 'CM'
AND pl.grndate <= '25-SEP-2007'
ORDER BY grndate, pl.grnid, pl.putawayid, pl.lineno;
But when i don't use the order by clause it is executing within 3 seconds. But i need to get the output in the sorted order as shown in the order by clause.
Is there any way to avoid order by clause and to get the same output as with order by clasue, and i need to execute the query with less time.
Please help me in this.
Thanks in advance
MahiDear Alok Kumar,
When i execute sql>set autotrace traceonly statistics ;
I am getting the below errors...
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
What could be the problem, how to resolve this to get the statistics?
But when i use sql>set autotrace traceonly explain; i got the below output for the above query..
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_GRNHDR'
2 1 INDEX (UNIQUE SCAN) OF 'SYS_C00293078' (UNIQUE)
3 0 SORT (UNIQUE)
4 3 NESTED LOOPS
5 4 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_GRNDTL'
6 5 INDEX (RANGE SCAN) OF 'SYS_C00293075' (UNIQUE)
7 4 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_VENDORINVOICEH
DR'
8 7 INDEX (UNIQUE SCAN) OF 'PK_VENDORINVOICE' (UNIQUE)
9 0 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_PUTAWAYDTL'
10 9 INDEX (UNIQUE SCAN) OF 'SYS_C00293260' (UNIQUE)
11 0 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_PUTAWAYHDR'
12 11 INDEX (UNIQUE SCAN) OF 'SYS_C00293263' (UNIQUE)
13 0 SORT (AGGREGATE)
14 13 NESTED LOOPS
15 14 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_PICKTICKETDTL'
16 15 INDEX (RANGE SCAN) OF 'F_L_P_CWI_IND1' (NON-UNIQUE)
17 14 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_PICKTICKETHDR'
18 17 INDEX (UNIQUE SCAN) OF 'SYS_C00293202' (UNIQUE)
19 0 SORT (AGGREGATE)
20 19 NESTED LOOPS
21 20 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_PICKTICKETDTL'
22 21 INDEX (RANGE SCAN) OF 'F_L_P_CWI_IND1' (NON-UNIQUE)
23 20 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_PICKTICKETHDR'
24 23 INDEX (UNIQUE SCAN) OF 'SYS_C00293202' (UNIQUE)
25 0 SORT (AGGREGATE)
26 25 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_INTERNALTRANSDTL
27 26 INDEX (RANGE SCAN) OF 'PK_INTERNALTRANSDTL' (UNIQUE)
28 0 SORT (AGGREGATE)
29 28 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_INTERNALTRANSDTL
30 29 INDEX (RANGE SCAN) OF 'PK_INTERNALTRANSDTL' (UNIQUE)
31 0 SORT (ORDER BY)
32 31 TABLE ACCESS (BY INDEX ROWID) OF 'FS_LG_PARTLOADS'
33 32 INDEX (RANGE SCAN) OF 'PK_PARTLOADS' (UNIQUE)
Please advice me regarding this...
Thanks in advance
Mahi -
THe following query is taking time. Is there anyway better to write this query.
SELECT PROGRAM_NAME_ID ,PROGRAM_NAME,sum(balance)"Unpaid Balance"
FROM (
SELECT DISTINCT
PROGRAM_NAME_ID ,PROGRAM_NAME,
t.billing_key billing_key,
(TUFF_GENERIC_PKG.GET_TOTAL(t.billing_key,t.program_key)+
nvl(PENALTY_INTEREST(t.billing_key,t.program_key,b.company_id,b.report_period ),0))
-PAYMENT_AMOUNT(B.COMPANY_ID,T.PROGRAM_KEY,B.REPORT_PERIOD) Balance,
Report_period,company_id
FROM BILLING B,
PROG_SURCH T ,
mv_program_dict P
WHERE
B.BILLING_KEY=T.BILLING_KEY
AND p.program_key= t.program_key(+)
and company_id=:p3_hide_comp
and b.SUBMIT_STATUS='S'
union
SELECT DISTINCT
PROGRAM_NAME_ID ,PROGRAM_NAME,
t.billing_key billing_key,
(TUFF_GENERIC_PKG.GET_TOTAL(t.billing_key,t.program_key)+
nvl(PENALTY_INTEREST(t.billing_key,t.program_key,b.company_id,b.report_period ),0))
-PAYMENT_AMOUNT(B.COMPANY_ID,T.PROGRAM_KEY,B.REPORT_PERIOD) Balance,
Report_period,company_id
FROM MV_BILLING B,
MV_PROG_SURCH T ,
mv_program_dict P
WHERE
B.BILLING_KEY=T.BILLING_KEY
AND p.program_key= t.program_key(+)
and company_id=:p3_hide_comp
order by report_period,program_name_id )
where balance>=0
GROUP BY PROGRAM_NAME_ID,PROGRAM_NAME
ORDER BY PROGRAM_NAME_IDHi,
This is totally right.
>
Being one such call. The price for calling pl/sql functions in SQL can be quite high. I'd highly recommend you find a way to incorporate the pl/sql code into the SQL query.
>
but, try with this query. I hope would help you and return the rows you want.
SELECT program_name_id, program_name,
SUM ( tuff_generic_pkg.get_total (billing_key, program_key)
+ NVL (penalty_interest (billing_key,
program_key,
company_id,
report_period
0
- payment_amount (company_id, program_key, report_period) balance
FROM (SELECT program_name_id, program_name, t.billing_key, t.program_key,
b.company_id, b.report_period
FROM billing b, prog_surch t, mv_program_dict p
WHERE b.billing_key = t.billing_key
AND p.program_key = t.program_key(+)
AND company_id = :p3_hide_comp
AND b.submit_status = 'S'
UNION
SELECT program_name_id, program_name, t.billing_key, t.program_key,
b.company_id, b.report_period report_period, company_id
FROM mv_billing b, mv_prog_surch t, mv_program_dict p
WHERE b.billing_key = t.billing_key
AND p.program_key = t.program_key(+)
AND company_id = :p3_hide_comp) sub
WHERE ( tuff_generic_pkg.get_total (billing_key, program_key)
+ NVL (penalty_interest (billing_key,
program_key,
company_id,
report_period
0
- payment_amount (company_id, program_key, report_period) >= 0
GROUP BY program_name_id, program_nameObviosly I cannot testing.
HTH -- johnxjean -- -
Hello
One of my report taking long to execute. i have range base partition on table and indexes by month. following are the details
SQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 7 13:41:04 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter user-name: sys as sysdba
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter optimizer;
NAME TYPE VALUE
optimizer_capture_sql_plan_baselines boolean FALSE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 11.2.0.1
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 10
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
optimizer_use_invisible_indexes boolean FALSE
optimizer_use_pending_statistics boolean FALSE
optimizer_use_sql_plan_baselines boolean TRUE
SQL> show parameter db_file_multi
NAME TYPE VALUE
db_file_multiblock_read_count integer 64
SQL> show parameter db_block_size
NAME TYPE VALUE
db_block_size integer 16384
SQL> show parameter cursor_sharing
NAME TYPE VALUE
cursor_sharing string EXACT
SQL>
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS AUTOGATHERING
SYSSTATS_INFO DSTART 10-07-2011 14:12
SYSSTATS_INFO DSTOP 10-07-2011 14:42
SYSSTATS_INFO FLAGS 0
SYSSTATS_MAIN CPUSPEEDNW 2526.08695652174
SYSSTATS_MAIN IOSEEKTIM 10
SYSSTATS_MAIN IOTFRSPEED 4096
SYSSTATS_MAIN SREADTIM
SYSSTATS_MAIN MREADTIM
SYSSTATS_MAIN CPUSPEED
SYSSTATS_MAIN MBRC
SYSSTATS_MAIN MAXTHR
SYSSTATS_MAIN SLAVETHR
SYSSTATS_TEMP SBLKRDS 640991392
SYSSTATS_TEMP SBLKRDTIM 23353628654370
SYSSTATS_TEMP MBLKRDS 128258266
SYSSTATS_TEMP MBLKRDTIM 6812382430610
SYSSTATS_TEMP CPUCYCLES 75032664
SYSSTATS_TEMP CPUTIM 29682662
SYSSTATS_TEMP JOB 12769
SYSSTATS_TEMP CACHE_JOB 12770
SYSSTATS_TEMP MBRTOTAL 3373935275
22 rows selected Any help or suggestion to improve its performance ?Execution plan is
PLAN_TABLE_OUTPUT
Plan hash value: 2727856908
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 1 | 1183 | 138K (1)| 00:32:21 | | | | | |
|* 1 | COUNT STOPKEY | | | | | | | | | | |
| 2 | PX COORDINATOR | | | | | | | | | | |
| 3 | PX SEND QC (ORDER) | :TQ10008 | 1 | 1183 | 138K (1)| 00:32:21 | | | Q1,08 | P->S | QC (ORDER) |
| 4 | VIEW | | 1 | 1183 | 138K (1)| 00:32:21 | | | Q1,08 | PCWP | |
|* 5 | SORT ORDER BY STOPKEY | | 1 | 400 | 138K (1)| 00:32:21 | | | Q1,08 | PCWP | |
| 6 | PX RECEIVE | | 1 | 1183 | | | | | Q1,08 | PCWP | |
| 7 | PX SEND RANGE | :TQ10007 | 1 | 1183 | | | | | Q1,07 | P->P | RANGE |
|* 8 | SORT ORDER BY STOPKEY | | 1 | 1183 | | | | | Q1,07 | PCWP | |
| 9 | NESTED LOOPS | | | | | | | | Q1,07 | PCWP | |
| 10 | NESTED LOOPS | | 1 | 400 | 138K (1)| 00:32:21 | | | Q1,07 | PCWP | |
| 11 | NESTED LOOPS | | 1 | 377 | 138K (1)| 00:32:21 | | | Q1,07 | PCWP | |
| 12 | NESTED LOOPS | | 1 | 341 | 138K (1)| 00:32:21 | | | Q1,07 | PCWP | |
|* 13 | HASH JOIN | | 1 | 324 | 138K (1)| 00:32:21 | | | Q1,07 | PCWP | |
| 14 | PX RECEIVE | | 1 | 289 | 123K (1)| 00:28:53 | | | Q1,07 | PCWP | |
| 15 | PX SEND BROADCAST | :TQ10006 | 1 | 289 | 123K (1)| 00:28:53 | | | Q1,06 | P->P | BROADCAST |
|* 16 | HASH JOIN | | 1 | 289 | 123K (1)| 00:28:53 | | | Q1,06 | PCWP | |
| 17 | PX RECEIVE | | 4 | 1016 | 123K (1)| 00:28:51 | | | Q1,06 | PCWP | |
| 18 | PX SEND BROADCAST | :TQ10005 | 4 | 1016 | 123K (1)| 00:28:51 | | | Q1,05 | P->P | BROADCAST |
|* 19 | HASH JOIN OUTER BUFFERED | | 4 | 1016 | 123K (1)| 00:28:51 | | | Q1,05 | PCWP | |
| 20 | PX RECEIVE | | | | | | | | Q1,05 | PCWP | |
| 21 | PX SEND HASH | :TQ10003 | | | | | | | Q1,03 | P->P | HASH |
| 22 | NESTED LOOPS | | | | | | | | Q1,03 | PCWP | |
| 23 | NESTED LOOPS | | 4 | 892 | 123K (1)| 00:28:51 | | | Q1,03 | PCWP | |
| 24 | NESTED LOOPS | | 6 | 948 | 123K (1)| 00:28:51 | | | Q1,03 | PCWP | |
| 25 | NESTED LOOPS | | 7 | 1043 | 123K (1)| 00:28:51 | | | Q1,03 | PCWP | |
|* 26 | HASH JOIN | | 5784 | 728K| 118K (1)| 00:27:45 | | | Q1,03 | PCWP | |
| 27 | PX RECEIVE | | 667K| 26M| 11597 (1)| 00:02:43 | | | Q1,03 | PCWP | |
| 28 | PX SEND BROADCAST | :TQ10000 | 667K| 26M| 11597 (1)| 00:02:43 | | | Q1,00 | P->P | BROADCAST |
| 29 | PX PARTITION RANGE ALL | | 667K| 26M| 11597 (1)| 00:02:43 | 1 | 14 | Q1,00 | PCWC | |
| 30 | WID TABLE ACCESS BY LOCAL INDEX RO | PAH01V1_DG1 | 667K| 26M| 11597 (1)| 00:02:43 | 1 | 14 | Q1,00 | PCWP | |
| 31 | BITMAP CONVERSION TO ROWIDS | | | | | | | | Q1,00 | PCWP | |
|* 32 | BITMAP INDEX SINGLE VALUE | MINDX_PAH01V1_DG1_14 | | | | | 1 | 14 | Q1,00 | PCWP | |
|* 33 | HASH JOIN | | 1826K| 151M| 107K (1)| 00:25:03 | | | Q1,03 | PCWP | |
| 34 | PX RECEIVE | | 2682 | 18774 | 58 (0)| 00:00:01 | | | Q1,03 | PCWP | |
| 35 | PX SEND BROADCAST | :TQ10001 | 2682 | 18774 | 58 (0)| 00:00:01 | | | Q1,01 | P->P | BROADCAST |
| 36 | PX BLOCK ITERATOR | | 2682 | 18774 | 58 (0)| 00:00:01 | 1 | 14 | Q1,01 | PCWC | |
| 37 | TABLE ACCESS FULL | PAH01V1_DG3 | 2682 | 18774 | 58 (0)| 00:00:01 | 1 | 14 | Q1,01 | PCWP | |
|* 38 | HASH JOIN | | 2409K| 183M| 107K (1)| 00:25:02 | | | Q1,03 | PCWP | |
| 39 | PX RECEIVE | | 476K| 19M| 5904 (1)| 00:01:23 | | | Q1,03 | PCWP | |
| 40 | PX SEND BROADCAST | :TQ10002 | 476K| 19M| 5904 (1)| 00:01:23 | | | Q1,02 | P->P | BROADCAST |
| 41 | PX PARTITION RANGE ALL | | 476K| 19M| 5904 (1)| 00:01:23 | 1 | 14 | Q1,02 | PCWC | |
| 42 | ROWID TABLE ACCESS BY LOCAL INDEX | PAH01V1_DG5 | 476K| 19M| 5904 (1)| 00:01:23 | 1 | 14 | Q1,02 | PCWP | |
| 43 | BITMAP CONVERSION TO ROWIDS | | | | | | | | Q1,02 | PCWP | |
| 44 | BITMAP MINUS | | | | | | | | Q1,02 | PCWP | |
| 45 | BITMAP MINUS | | | | | | | | Q1,02 | PCWP | |
| 46 | BITMAP MERGE | | | | | | | | Q1,02 | PCWP | |
| 47 | BITMAP INDEX FULL SCAN | MINDX_PAH01V1_DG517 | | | | | 1 | 14 | Q1,02 | PCWP | |
|* 48 | E BITMAP INDEX SINGLE VALU | MINDX_PAH01V1_DG5_3 | | | | | 1 | 14 | Q1,02 | PCWP | |
|* 49 | BITMAP INDEX SINGLE VALUE | MINDX_PAH01V1_DG5_3 | | | | | 1 | 14 | Q1,02 | PCWP | |
| 50 | PX BLOCK ITERATOR | | 275M| 9G| 101K (1)| 00:23:37 | 1 | 14 | Q1,03 | PCWC | |
|* 51 | TABLE ACCESS FULL | PAH01V1_JT | 275M| 9G| 101K (1)| 00:23:37 | 1 | 14 | Q1,03 | PCWP | |
| 52 | PARTITION RANGE ALL | | 1 | 20 | 1 (0)| 00:00:01 | 1 | 14 | Q1,03 | PCWP | |
|* 53 | TABLE ACCESS BY LOCAL INDEX ROWID | PAH01V1_DG2 | 1 | 20 | 1 (0)| 00:00:01 | 1 | 14 | Q1,03 | PCWP | |
|* 54 | INDEX RANGE SCAN | PKINDX_PAH01V1_DG2_28 | 1 | | 1 (0)| 00:00:01 | 1 | 14 | Q1,03 | PCWP | |
| 55 | PARTITION RANGE ALL | | 1 | 9 | 0 (0)| 00:00:01 | 1 | 14 | Q1,03 | PCWP | |
| 56 | TABLE ACCESS BY LOCAL INDEX ROWID | PAH01V1_DG4 | 1 | 9 | 0 (0)| 00:00:01 | 1 | 14 | Q1,03 | PCWP | |
|* 57 | INDEX RANGE SCAN | PKINDX_PAH01V1_DG4 | 1 | | 0 (0)| 00:00:01 | 1 | 14 | Q1,03 | PCWP | |
| 58 | PARTITION RANGE ALL | | 1 | | 1 (0)| 00:00:01 | 1 | 14 | Q1,03 | PCWP | |
|* 59 | INDEX RANGE SCAN | PKINDX_PAH01V1_DG0 | 1 | | 1 (0)| 00:00:01 | 1 | 14 | Q1,03 | PCWP | |
| 60 | TABLE ACCESS BY LOCAL INDEX ROWID | PAH01V1_DG0 | 1 | 65 | 1 (0)| 00:00:01 | 1 | 1 | Q1,03 | PCWP | |
| 61 | PX RECEIVE | | 296 | 9176 | 2 (0)| 00:00:01 | | | Q1,05 | PCWP | |
| 62 | PX SEND HASH | :TQ10004 | 296 | 9176 | 2 (0)| 00:00:01 | | | Q1,04 | P->P | HASH |
| 63 | PX BLOCK ITERATOR | | 296 | 9176 | 2 (0)| 00:00:01 | | | Q1,04 | PCWC | |
| 64 | TABLE ACCESS FULL | PAH01V1_STORE_LKP | 296 | 9176 | 2 (0)| 00:00:01 | | | Q1,04 | PCWP | |
| 65 | PX PARTITION RANGE ITERATOR | | 1571K| 52M| 167 (1)| 00:00:03 | KEY | 14 | Q1,06 | PCWC | |
| 66 | TABLE ACCESS BY LOCAL INDEX ROWID | PAH01V1_DG0 | 1571K| 52M| 167 (1)| 00:00:03 | KEY | 14 | Q1,06 | PCWP | |
| 67 | BITMAP CONVERSION TO ROWIDS | | | | | | | | Q1,06 | PCWP | |
| 68 | BITMAP AND | | | | | | | | Q1,06 | PCWP | |
| 69 | BITMAP MERGE | | | | | | | | Q1,06 | PCWP | |
|* 70 | BITMAP INDEX RANGE SCAN | MINDX_PAH01V1_DG022 | | | | | KEY | 14 | Q1,06 | PCWP | |
| 71 | BITMAP MERGE | | | | | | | | Q1,06 | PCWP | |
|* 72 | BITMAP INDEX RANGE SCAN | MINDX_PAH01V1_DG0_8 | | | | | KEY | 14 | Q1,06 | PCWP | |
| 73 | PX PARTITION RANGE ITERATOR | | 2594K| 86M| 14858 (1)| 00:03:29 | KEY | 14 | Q1,07 | PCWC | |
| 74 | TABLE ACCESS BY LOCAL INDEX ROWID | PAH01V1_JT | 2594K| 86M| 14858 (1)| 00:03:29 | KEY | 14 | Q1,07 | PCWP | |
| 75 | BITMAP CONVERSION TO ROWIDS | | | | | | | | Q1,07 | PCWP | |
|* 76 | BITMAP INDEX RANGE SCAN | MINDX_PAH01V1_JT_PF_ | | | | | KEY | 14 | Q1,07 | PCWP | |
| 77 | PARTITION RANGE ITERATOR | | 1 | 17 | 1 (0)| 00:00:01 | KEY | 14 | Q1,07 | PCWP | |
|* 78 | TABLE ACCESS BY LOCAL INDEX ROWID | PAH01V1_DG2 | 1 | 17 | 1 (0)| 00:00:01 | KEY | 14 | Q1,07 | PCWP | |
|* 79 | INDEX RANGE SCAN | PKINDX_PAH01V1_DG2_28 | 1 | | 1 (0)| 00:00:01 | KEY | 14 | Q1,07 | PCWP | |
| 80 | PARTITION RANGE ITERATOR | | 1 | 36 | 1 (0)| 00:00:01 | KEY | 14 | Q1,07 | PCWP | |
| 81 | TABLE ACCESS BY LOCAL INDEX ROWID | PAH01V1_DG5 | 1 | 36 | 1 (0)| 00:00:01 | KEY | 14 | Q1,07 | PCWP | |
|* 82 | INDEX RANGE SCAN | PKINDX_PAH01V1_DG5_18 | 1 | | 1 (0)| 00:00:01 | KEY | 14 | Q1,07 | PCWP | |
| 83 | PARTITION RANGE ITERATOR | | 1 | | 1 (0)| 00:00:01 | KEY | 14 | Q1,07 | PCWP | |
|* 84 | INDEX RANGE SCAN | PKINDX_PAH01V1_DG1_22 | 1 | | 1 (0)| 00:00:01 | KEY | 14 | Q1,07 | PCWP | |
|* 85 | TABLE ACCESS BY LOCAL INDEX ROWID | PAH01V1_DG1 | 1 | 23 | 1 (0)| 00:00:01 | 1 | 1 | Q1,07 | PCWP | |
135 rows selected -
Query taking time when MVIEW is used!!!
Dear All,
Whenever i try and execute a query involving Materialized View(MVIEW), more often i have seen that if the query takes *5hrs* to execute and MVIEW refresh is every *2hrs*, it'll throw error as "error -- precedeing line from ...".
I just wanted to confirm if there will be a problem in conditions where query execution is overlapping the then next MVIEW refresh???
** Sorry could not provide the exact errorSo what do you think what ORACLE is doing? Giving you the "latest" update? Of course not, you have read consistency,so as soon as the data changed, your query reads from UNDO. Is the MV a "fast" or "complete" refresh? If its "fast" if should not matter too much, depending on the amount of updates. But I bet it's "complete".
How long does the refresh go? That should be < 2h right? So your query will not get substantial slower when using the source of the MV directly.
5h is massive. I bet that can be done better. If not (wanna bet ? ;-) ) how long does the query take without MV refresh (for a test)? Then you can put the MV data in a temp table and use that for a start.
And get your error handler right.
-- andy -
MY QUERY IS TAKING TIME WHILE EXECUTING IN WAD
HI BW GURUS
If i execute the report(using query with variables) which contains 8,50,000 records in WAD then its taking more than 900 seconds and say Connection timed out at the end.
If i execute the same query in Query designer using Web browser then it will take 400 seconds to show all the data in hierarchy or tabular view.
I've done tuning using RSRT on query read mode and persistent mode etc..
Can you please help me?Execution plan depends on many factors, statistics status of the objects, system statistics if you are using, init.ora parameters like mulitblock_read_count, parallellism, etc.
If you want to use same execution plan for all database, you should refer stored_outline. In 10g you can try sql profiling.
Ashok -
Query taking longer to execute the second time.
Hello,
I have a query joing few tables and views and when i execute it the first them, it executes within a seconds, immediately if i execute it the second time it takes about 40 seconds to execute. I am using Oracle 11g [11.2.0.1.0].
Please find the TKPROF output.
call count cpu elapsed disk query current rows
Parse 1 0.26 0.24 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 23 0.81 0.82 0 5610 0 326
total 25 1.07 1.07 0 5610 0 326
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 127
call count cpu elapsed disk query current rows
Parse 1 0.23 0.23 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 23 41.01 41.00 0 38218 0 326
total 25 41.24 41.24 0 38218 0 326
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 127Hi Nicholay,
VPD is not being used in our application. ArcSDE Multi-Versionsed View uses some functions in VW_ objects. In Oracle 10g I dont have this issue.
Here is the output from V$SQL_SHARED_CURSOR.
"SQL_ID" "ADDRESS" "CHILD_ADDRESS" "CHILD_NUMBER" "UNBOUND_CURSOR" "SQL_TYPE_MISMATCH" "OPTIMIZER_MISMATCH" "OUTLINE_MISMATCH" "STATS_ROW_MISMATCH" "LITERAL_MISMATCH" "FORCE_HARD_PARSE" "EXPLAIN_PLAN_CURSOR" "BUFFERED_DML_MISMATCH" "PDML_ENV_MISMATCH" "INST_DRTLD_MISMATCH" "SLAVE_QC_MISMATCH" "TYPECHECK_MISMATCH" "AUTH_CHECK_MISMATCH" "BIND_MISMATCH" "DESCRIBE_MISMATCH" "LANGUAGE_MISMATCH" "TRANSLATION_MISMATCH" "BIND_EQUIV_FAILURE" "INSUFF_PRIVS" "INSUFF_PRIVS_REM" "REMOTE_TRANS_MISMATCH" "LOGMINER_SESSION_MISMATCH" "INCOMP_LTRL_MISMATCH" "OVERLAP_TIME_MISMATCH" "EDITION_MISMATCH" "MV_QUERY_GEN_MISMATCH" "USER_BIND_PEEK_MISMATCH" "TYPCHK_DEP_MISMATCH" "NO_TRIGGER_MISMATCH" "FLASHBACK_CURSOR" "ANYDATA_TRANSFORMATION" "INCOMPLETE_CURSOR" "TOP_LEVEL_RPI_CURSOR" "DIFFERENT_LONG_LENGTH" "LOGICAL_STANDBY_APPLY" "DIFF_CALL_DURN" "BIND_UACS_DIFF" "PLSQL_CMP_SWITCHS_DIFF" "CURSOR_PARTS_MISMATCH" "STB_OBJECT_MISMATCH" "CROSSEDITION_TRIGGER_MISMATCH""PQ_SLAVE_MISMATCH" "TOP_LEVEL_DDL_MISMATCH" "MULTI_PX_MISMATCH" "BIND_PEEKED_PQ_MISMATCH" "MV_REWRITE_MISMATCH" "ROLL_INVALID_MISMATCH" "OPTIMIZER_MODE_MISMATCH" "PX_MISMATCH" "MV_STALEOBJ_MISMATCH" "FLASHBACK_TABLE_MISMATCH" "LITREP_COMP_MISMATCH" "PLSQL_DEBUG" "LOAD_OPTIMIZER_STATS" "ACL_MISMATCH" "FLASHBACK_ARCHIVE_MISMATCH" "LOCK_USER_SCHEMA_FAILED" "REMOTE_MAPPING_MISMATCH" "LOAD_RUNTIME_HEAP_FAILED" "HASH_MATCH_FAILED" "PURGED_CURSOR" "BIND_LENGTH_UPGRADEABLE"
"7rtqvjtyp06k9" "000007FFABD3A918" "000007FFABD49C88" "1" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N"
"7rtqvjtyp06k9" "000007FFABD3A918" "000007FFABD3A7B8" "0" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N"
"7rtqvjtyp06k9" "000007FFABD3A918" "000007FFABD46A40" "2" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N"
"7rtqvjtyp06k9" "000007FFABD3A918" "000007FFABD3A7B8" "0" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N"
"7rtqvjtyp06k9" "000007FFABD3A918" "000007FFABD49C88" "1" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N"
"7rtqvjtyp06k9" "000007FFABD3A918" "000007FFABD46A40" "2" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N"
"7rtqvjtyp06k9" "000007FFABD3A918" "000007FFABD3A7B8" "0" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N"
"7rtqvjtyp06k9" "000007FFABD3A918" "000007FFABD49C88" "1" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N"
"7rtqvjtyp06k9" "000007FFABD3A918" "000007FFABD46A40" "2" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" Edited by: 955237 on 29 Aug, 2012 1:57 AM -
Report is taking time to execute the following query
Hi All,
I have one query using in reports6i,which i am describing down,its taking half an hour to execute.
I need to tune the query,if any one could help or any suggestions...........highly appreciable.
SELECT +ALL_ROWS
DISTINCT sm.orgn_code,
sm.sample_no,
-- DECODE (sm.batch_id, NULL, 'Item/Locn', 'Production') AS sample_type,
NVL2(sm.batch_id, 'Production', 'Item/Locn') AS sample_type,
sm.date_drawn,
su.user_name AS drawn_by,
im.item_no,
lm.lot_no,
im.inv_type,
qt.test_code,
rm.user_name AS result_by,
rm.result_date,
qt.test_type,
qv.min_value_num,
qv.max_value_num,
DECODE(qt.test_type, 'N', TO_CHAR(qv.min_value_num) || ' - ' || TO_CHAR(qv.max_value_num), NULL) AS the_range,
DECODE(qt.test_type, 'N', TO_CHAR(qv.target_value_num), qv.target_value_char) AS the_spec,
DECODE(qt.test_type, 'N', TO_CHAR(rm.result_value_num), rm.result_value_char) AS the_result,
DECODE(qt.test_unit, 'N/A', NULL, qt.test_unit) AS qc_uom,
DECODE(sm.sample_disposition,
'0RT',
'RETAIN',
'1P',
'PENDING',
'2I',
'IN PROGRESS',
'3C',
'COMPLETE',
'4A',
'ACCEPT',
'5AV',
'ACCEPT WITH VARIANCE',
'6RJ',
'REJECT',
'7CN',
'CANCEL',
NULL) AS disposition
FROM gmd.gmd_samples sm,
-- gmd.gmd_results rm,
gmd.gmd_qc_tests_b qt,
gmd.gmd_specifications_b sp,
gmd.gmd_spec_tests_b qv,
gmi.ic_lots_mst lm,
apps.ic_item_mst im,
applsys.fnd_user su,
(SELECT gr.result_date,
gr.sample_id,
gr.test_id,
gr.result_value_num,
gr.result_value_char,
ru.user_name
FROM gmd_results gr,
applsys.fnd_user ru
WHERE (to_date(to_char(gr.result_date,'mm/dd/yyyy'),'mm/dd/yyyy') BETWEEN
to_date(to_char(:p_2_start_date,'mm/dd/yyyy'),'mm/dd/yyyy') AND
to_date(to_char(:p_3_end_date,'mm/dd/yyyy'),'mm/dd/yyyy'))
AND gr.result_date IS NOT NULL
AND ru.user_id = gr.last_updated_by) rm
WHERE 1 = 1 --rm.result_date IS NOT NULL
-- AND TO_DATE (TO_CHAR (rm.result_date, 'mm/dd/yyyy'), 'mm/dd/yyyy') >=TO_DATE (TO_CHAR (:p_2_start_date, 'mm/dd/yyyy'), 'mm/dd/yyyy')
-- AND TO_DATE (TO_CHAR (rm.result_date, 'mm/dd/yyyy'), 'mm/dd/yyyy') <=TO_DATE (TO_CHAR (:p_3_end_date, 'mm/dd/yyyy'), 'mm/dd/yyyy')
AND im.inv_type = NVL (UPPER (:p_inv_type), im.inv_type)
AND sm.orgn_code = UPPER (:p_1_orgn)
AND sm.item_id = lm.item_id --double
AND sm.lot_id = lm.lot_id
AND sm.item_id = lm.item_id --double
AND sm.item_id = im.item_id
AND sp.item_id = im.item_id
AND rm.sample_id = sm.sample_id
AND su.user_id = sm.sampler_id
-- AND ru.user_id = rm.last_updated_by
AND rm.test_id = qt.test_id
AND qt.test_id = qv.test_id
AND qv.spec_id = sp.spec_id
AND sp.spec_status = 700
AND qt.test_code LIKE NVL(:p_test, '%')
AND ( ( qt.test_type = 'N'
AND ( rm.result_value_num < qv.min_value_num
OR rm.result_value_num > qv.max_value_num))
OR ( qt.test_type <> 'N'
AND rm.result_value_char <> 'OK'
AND rm.result_value_char <> qv.target_value_char)
Thanks in AdvanceYou may want to consider demoralization views/tables or create indexes etc. to improve performance. Post it to
PL/SQL
to get more and quicker responses. -
For loop its taking time to execute if more records
Hi
I want to move the data with some condition and formatting which has 165000 rows in a table.
I want use loop to fetch these records and move to another table. I am using for .. loop to execute, its taking long time .
which way is better to execute fast?
Thanks in advance,
Maranuser8732035 wrote:
Hi
I want to move the data with some condition and formatting which has 165000 rows in a table.
I want use loop to fetch these records and move to another table. I am using for .. loop to execute, its taking long time .
which way is better to execute fast?
Thanks in advance,
MaranLooping is bad... it is actually row-by-row processing of data(i.e. slow-by-slow processing).
So, in place of using Pl/Sql, instead simply use a INSERT SQL query.
insert into <table1>
select col1,col2,... from <table2>
where <condns>;HTH
Ranit B. -
Query takes time to execute. Review this query and give me a possible quere
SELECT DISTINCT A.REFERENCE_NUMBER
FROM A,B,C
WHERE DF_N_GET_CONTRACT_STATUS (A.REFERENCE_NUMBER, TRUNC (SYSDATE)) = 1
AND ( B.CHQ_RTN_INDICATOR IS NULL AND B.CHALLAN_NUMBER IS NULL
AND C.INSTRUMENT_TYPE IN (1, 2) AND C.MODULE_CODE = 5 )
AND ( A.HEADER_KEY = B.HEADER_KEY AND C.HEADER_KEY = B.HEADER_KEY);
This query takes 3 minutes to execute. I want to improve the performance so that it can execute with in seconds.
Table A has 10 lakhs record.
Table B has 3.7 lakhs record.
Table C has 5.3 lakhs record. Consider DF_N_GET_CONTRACT_STATUS as function. REFERENCE_NUMBER is the type of Varchar2(20).
Plz give me a correct logical and fastest execution query for the same.
Thanks in advance.I would agree with the post from Santosh above that you should review the guidelines for posting a tuning request. This is VERY important. It is impossile to come up with any useful suggestions without the proper information.
In the case of your query, I would probably focus my attention on the function that you have defined. What happens if the condition using the DF_N_GET_CONTRACT_STATUS function is removed? Does it still take 3 minutes?
SELECT reference_number
from (
SELECT DISTINCT A.REFERENCE_NUMBER
FROM A,B,C
WHERE ( B.CHQ_RTN_INDICATOR IS NULL AND B.CHALLAN_NUMBER IS NULL
AND C.INSTRUMENT_TYPE IN (1, 2) AND C.MODULE_CODE = 5 )
AND ( A.HEADER_KEY = B.HEADER_KEY AND C.HEADER_KEY = B.HEADER_KEY)
where DF_N_GET_CONTRACT_STATUS(reference_number, trunc(sysdate)) = 1;Of course, the query above really depends on the cardinality of the returned data..... which is impossible to know without following the posting guidelines. This query could return anywhere between 0 rows and 2x10^17 rows. And in the latter case evaluating the function at the end wouldn't make any difference.
Also, do you really need the distinct? Does it make any difference? Most of the time that I see distinct, to me it either means the query is wrong or the data model is wrong. -
I have a query -->select c1,c2,c3 from table1 . This query takes only few milliseconds. But when I take count from the same query i.e. when I execute select count(c1,c2,c3) from table1 then it takes a very long time (about 1 min). The table1 contains about 25000 rows. Please help to improve performance of Count query.
Satej wrote:
I have a query -->select c1,c2,c3 from table1 . This query takes only few milliseconds. But when I take count from the same query i.e. when I execute select count(c1,c2,c3) from table1 then it takes a very long time (about 1 min).Classic misperception of Toad, SQL Navigator and similar tool users. All these tools fetch just first result screen and show time it took to fetch just that and not the time to fetch all rows. And in order to count you need to fetch all rows.l That is why select count(*) takes longer. But 1 min for 25000 rows is a bit long. Check execution plan to see what is going on.
SY. -
Hi:
We are using a common component for generating query screens wherein we just have to pass a query number to the component which in turn return a list view of records.
We have a particular Query which when executed through Toad or any SQL tool returns records within 4-5 seconds but the same one takes almost 3 minutes to load from Front End.
What could be the possible reason for the page to take so much time to load.
We are using WebSphere 6.0.2.17 server. Is there any settings to be done for statement cache size or for any connection timeout or is there anything to be done at Oracle side.
Since the moment we change the query number to some simple query like select * from dual kind the screen loads instantly.
P.S: The query takes almost 4-5 seconds to execute in backend through TOAD.
Avadhoot SawantSo 45 or 47? Nevertheless ...
This is hardly a heavy calculation, the savings will be dismal. Also anything numeric is very easy on CPU in general.
But
convert( numeric(8,5), (convert( numeric,T3.COl7) / 1000000))
is not optimal.
CONVERT( NUMERIC(8,5),300 / 1000000.00000 )
Is
Now it boils to how to make load faster: do it in parallel. Find how many sockets the machine have and split the table into as many chunks. Also profile to find out where it spends most of the time. I saw sometimes the network is not letting me thru so you
may want to play with buffers, and packet sizes, for example if OLEDB used increase the packet size two times see if works faster, then x2 more and so forth.
To help you further you need to tell more e.g. what is this source, destination, how you configured the load.
Please understand that there is no Silver Bullet anywhere, or a blanket solution, and you need to tell me your desired load time. E.g. if you tell me it needs to load in 5 min I will give your ask a pass.
Arthur
MyBlog
Twitter -
Query taking time in Oracle 10g
Hi,
Recently we had a database upgrade from 9.2.0.8 to 10.2.0.4. We use HP-UX B11.23 as OS.The problem is we have a query which used to take 3 mins in 9i database but it is not returning any output in 10g database after running for 8 hours after which we need to kill it . The query is ,
SELECT DPPB.CO_CD, DPPB.PRC_BOOK_CD,NVL(PB.CO_PRC_BOOK_CD,'NULL') ,
NVL(BP.BASE_PROD_CD,'NULL'),NVL(FG.FG_CD,'NULL'),DPPB.EFFTV_STRT_DT,
DPPB.EFFTV_END_DT,PRC_BOOK_AMT, PRC_LST_RPT_IND ,
SYSDATE + (RANK () OVER (PARTITION BY PROD_PRC_BOOK_CD ORDER BY DPPB.EFFTV_STRT_DT)/(24*60*60)) "RANK",
SYSDATE FROM
DIM_PROD_PRC_BOOK DPPB,dim_prod FG,dim_prod BP,dim_prc_book PB
WHERE
DPPB.BASE_PROD_OID =BP.BASE_PROD_OID and bp.end_date>sysdate and bp.be_id=bp.base_prod_oid AND
FG.FG_OID=DPPB.FG_OID and fg.end_date>sysdate and fg.be_id=fg.fg_oid
AND DPPB.PRC_BOOK_OID=PB.prc_book_oid and pb.end_date>sysdate and pb.be_id=pb.PRC_BOOK_OID
AND DPPB.EFFTV_END_DT > ADD_MONTHS(TRUNC(SYSDATE), -15)
AND DPPB.CURR_IND='Y'
AND
PROD_PRC_BOOK_CD ||'-'||TO_CHAR(DPPB.END_DATE ,'DD-MM-YYYY hh24:mi:ss')
IN(
SELECT PROD_PRC_BOOK_CD ||'-'||TO_CHAR(MAX(DPPB.END_DATE ),'DD-MM-YYYY hh24:mi:ss')
FROM DIM_PROD_PRC_BOOK DPPB WHERE PROD_PRC_BOOK_CD IS NOT NULL GROUP BY PROD_PRC_BOOK_CD ,EFFTV_STRT_DT
)The explain plan of the query in 9i is,
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=CHOOSE 1 2964
WINDOW SORT 1 661 2964
HASH JOIN 1 661 2958
TABLE ACCESS BY INDEX ROWID WHSUSR.DIM_PROD 1 73 1
NESTED LOOPS 1 355 290
NESTED LOOPS 1 282 289
HASH JOIN 164 32 K 284
TABLE ACCESS FULL WHSUSR.DIM_PRC_BOOK 1 57 2
TABLE ACCESS FULL WHSUSR.DIM_PROD_PRC_BOOK 6 K 957 K 281
TABLE ACCESS BY INDEX ROWID WHSUSR.DIM_PROD 1 77 1
INDEX RANGE SCAN WHSUSR.XN15_DIM_PROD 3 1
INDEX RANGE SCAN WHSUSR.XN22_DIM_PROD 5 1
VIEW SYS.VW_NSO_1 132 K 38 M 2665
SORT UNIQUE 132 K 6 M 2665
SORT GROUP BY 132 K 6 M 2665
TABLE ACCESS FULL WHSUSR.DIM_PROD_PRC_BOOK 132 K 6 M 281 And the explain plan of the query in 10g database is
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=ALL_ROWS 4 1702
WINDOW SORT 4 1 K 1702
FILTER
TABLE ACCESS BY INDEX ROWID WHSUSR.DIM_PROD 1 73 1
NESTED LOOPS 1 339 899
NESTED LOOPS 14 3 K 898
HASH JOIN 2 K 428 K 805
TABLE ACCESS FULL WHSUSR.DIM_PRC_BOOK 1 53 3
TABLE ACCESS FULL WHSUSR.DIM_PROD_PRC_BOOK 93 K 12 M 801
TABLE ACCESS BY INDEX ROWID WHSUSR.DIM_PROD 1 77 1
INDEX RANGE SCAN WHSUSR.XN15_DIM_PROD 2 1
INDEX RANGE SCAN WHSUSR.XN22_DIM_PROD 5 1
FILTER
HASH GROUP BY 1 K 59 K 802
TABLE ACCESS FULL WHSUSR.DIM_PROD_PRC_BOOK 117 K 5 M 794 Please help in identifying the problem and how to tune it.user605926 wrote:
Thanks Sir for your immense help. I used the hint /*+ optimizer_features_enable('9.2.0.8') */ and the query took only 2 seconds. I am really delighted.
Sorry for not clicking the 'helpful' button earlier since honestly I did not know about the rules. Going forward I will not forget to do that.Don't apologise, it wasn't intended as a personal criticism - it's just a footnote I tend to use at present as a general reminder to everyone that feedback is useful.
I have one question. Do i have to use this hint for each and every query that is becoming a headache or is their any permanent solution to fix all the queries that used to run good on 9.2.0.8 database ? Please suggest.When doing an upgrade it is always valid (in the short term) to set the optimizer_features_enable parameter to the value of the database your moving from so that you can get the code improvements (or bug fixes) of the newer software without risking execution plan changes.
After that the ideal is to test software and identify generic cases where a change like an index definition, or some statistical information needs to be corrected for a particular reason in classes of queries. Eventually you get down to the point where you have a few awkward queries which the optimizer can't handle where you need hints. The optimizer_features_enable is very convenient here. In 10g, however, you could then capture the older plan and record is as an SQL Baseline against the unhinted query rather than permanently including hints.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
A general reminder about "Forum Etiquette / Reward Points": http://forums.oracle.com/forums/ann.jspa?annID=718
If you never mark your questions as answered people will eventually decide that it's not worth trying to answer you because they will never know whether or not their answer has been of any use, or whether you even bothered to read it.
It is also important to mark answers that you thought helpful - again it lets other people know that you appreciate their help, but it also acts as a pointer for other people when they are researching the same question, moreover it means that when you mark a bad or wrong answer as helpful someone may be prompted to tell you (and the rest of the forum) what's so bad or wrong about the answer you found helpful.
Maybe you are looking for
-
Weird lines showing up on Flash Blur
a bunch of lines (sometimes just a few) will move over my animation where i have a blur effect View sample JPG snapshot
-
Just finished burning DVD and I get yellow warnings about TS file. Help!
"Warning: The directory '/Users/..............Library/Caches/DVD Studio Pro Files/VIDEO_TS/Render Data' will not be included in the final disc." I exported from FC6 into Compressor at top quality. Brought in the two files to DVDSPRO and got everythin
-
I installed CMS per the instructions. In step 4 of creating E-site I get the following after clicking submit (_Menu_for_Site ): Exception: java.lang.NullPointerException at cms.TopicModule.createDefaultACL(Compiled Code) at ifs.files._ifs._
-
My MacBook is sluggish. Everything is up to date and it isn't my wifi because the other computers in the house run fine. Does anyone have any ideas to help performance?
-
Is there any way I can invoke the menu code when I press a button in the form. The menu is attached to form. Thanks in advance.