Performance optimization in Select query
Hi All,
Please suggest good performance practice for the below code.
SELECT * FROM BKPF WHERE BUKRS IN SO_BUKRS
AND BELNR IN SO_BELNR
AND GJAHR IN SO_GJAHR
AND BLART IN SO_BLART
AND BUDAT IN SO_BUDAT
AND USNAM IN SO_USNAM.
CLEAR BSEG.
SELECT * FROM BSEG WHERE BUKRS EQ BKPF-BUKRS
AND BELNR EQ BKPF-BELNR
AND GJAHR EQ BKPF-GJAHR
AND KOART EQ 'K'.
SELECT SINGLE * FROM LFA1 WHERE LIFNR EQ BSEG-LIFNR
AND KTOKK IN SO_KTOKK.
CHECK SY-SUBRC EQ 0.
MOVE-CORRESPONDING BKPF TO ITAB2.
MOVE BSEG-LIFNR TO ITAB2-LIFNR.
APPEND ITAB2.
ENDSELECT.
PERFORM CHECK_FOR_REVERSAL.
ENDSELECT.
Thanks
Sonal
declare internal table for BKPF, BSEG & LFA1 separately.
instead of using Select & End select, use for all entries.
SELECT * FROM BKPF into table itab1 WHERE BUKRS IN SO_BUKRS
AND BELNR IN SO_BELNR
AND GJAHR IN SO_GJAHR
AND BLART IN SO_BLART
AND BUDAT IN SO_BUDAT
AND USNAM IN SO_USNAM.
if not itab1[] is initial.
sort bkpf by belnr.
SELECT * FROM BSEG into table itab2
for all entries in itab1
WHERE BUKRS EQ itab1-BUKRS
AND BELNR EQ itab1-BELNR
AND GJAHR EQ itab1-GJAHR
AND KOART EQ 'K'.
if not itab2[] is initial.
sort itab2 by lifnr
SELECT SINGLE * FROM LFA1 into table itab3
for all entries in itab2
WHERE LIFNR EQ itab2-LIFNR
AND KTOKK IN SO_KTOKK.
endif.
endif.
endif.
sort itab1 by belnr.
sort itab2 by belnr.
sort itab3 by lifnr.
loop at itab1.
move-corresponding itab1 to itfinal.
loop at itab2 where belnr = itab1-belnr.
move-corresponding itab2 to itfinal.
read itab3 with key lifnr = itab2-lifnr.
if sy-subrc = 0.
move-corresponding itab3 to itfinal.
endif.
endloop.
append itfinal.
clear itfinal.
endloop.
Similar Messages
-
Performance optimization on select query for all entries
Hi All,
I want to optimize the select query in my Program.
The select query is taking lot of time to search the records for the given condition in the where clause
and more interestingly there are no records fetched from the database as the where condition does not matches.
It is taking more than 30 min to search the record and the result is no record found.
Below is my select query. I have also created the secondary Index for the same.
In My opinion FOR ALL ENTRIES is taking lot of time. Because there are more than 1200 records in internal table t_ajot
select banfn bnfpo bsart txz01 matnr Werks lgort matkl reswk menge meins flief ekorg
INTO CORRESPONDING FIELDS OF TABLE t_req
FROM eban
FOR ALL ENTRIES IN t_ajot
WHERE matkl >= t_ajot-matkl_low
AND matkl <= t_ajot-matkl_high
AND werks = t_ajot-werks
AND loekz = ' '
AND badat IN s_badat
AND bsart = 'NB'.
Please suggest.Hi,
that,
FOR ALL ENTRIES IN t_ajot
WHERE matkl >= t_ajot-matkl_low
AND matkl <= t_ajot-matkl_high
AND werks = t_ajot-werks
AND loekz = ' '
AND badat IN s_badat
AND bsart = 'NB'.
looks strange.
However:
How does your index look like?
What executoin plan do you get?
How do the statistics look like?
Whats the content of the variables t_ajot-... and s_badata?
Kind regards,
Hermann -
Performance Problem in Select query
Hi,
I have performance Problem in following Select Query :
SELECT VBELN POSNR LFIMG VRKME VGBEL VGPOS
FROM LIPS INTO CORRESPONDING FIELDS OF TABLE GT_LIPS
FOR ALL ENTRIES IN GT_EKPO1
WHERE VGBEL = GT_EKPO1-EBELN
AND VGPOS = GT_EKPO1-EBELP.
as per trace i have analysed that it is fetch the complete table scan from the LIPS table and table contants almost 3 lakh records.
Kindly Suggest what we can do to optimize this query.
Regards,
Harshtypes: begin of line,
vbeln type lips-vbeln
posnr type lips-posnr
lfimg type lips-lfimg
vrkme type lips-vrkme
vgbel type lips- vgbel
vgpos type lips-vgpos
end of line.
data: itab type standard table of line,
wa type line.
IF GT_EKPO1[] IS NOT INITIAL.
SELECT VBELN POSNR LFIMG VRKME VGBEL VGPOS
FROM LIPS INTO TABLE ITAB
FOR ALL ENTRIES IN GT_EKPO1
WHERE VGBEL = GT_EKPO1-EBELN
AND VGPOS = GT_EKPO1-EBELP.
ENDIF. -
How to optimize the select query that is executed in a cursor for loop?
Hi Friends,
I have executed the code below and clocked the times for every line of the code using DBMS_PROFILER.
CREATE OR REPLACE PROCEDURE TEST
AS
p_file_id NUMBER := 151;
v_shipper_ind ah_item.shipper_ind%TYPE;
v_sales_reserve_ind ah_item.special_sales_reserve_ind%TYPE;
v_location_indicator ah_item.exe_location_ind%TYPE;
CURSOR activity_c
IS
SELECT *
FROM ah_activity_internal
WHERE status_id = 30
AND file_id = p_file_id;
BEGIN
DBMS_PROFILER.start_profiler ('TEST');
FOR rec IN activity_c
LOOP
SELECT DISTINCT shipper_ind, special_sales_reserve_ind, exe_location_ind
INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
FROM ah_item --464000 rows in this table
WHERE item_id_edw IN (
SELECT item_id_edw
FROM ah_item_xref --700000 rows in this table
WHERE item_code_cust = rec.item_code_cust
AND facility_num IN (
SELECT facility_code
FROM ah_chain_div_facility --17 rows in this table
WHERE chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
AND div_id = (SELECT div_id
FROM ah_div --8 rows in this table
WHERE division = rec.division)));
END LOOP;
DBMS_PROFILER.stop_profiler;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN TOO_MANY_ROWS
THEN
NULL;
END TEST;The SELECT query inside the cursor FOR LOOP took 773 seconds.
I have tried using BULK COLLECT instead of cursor for loop but it did not help.
When I took out the select query separately and executed with a sample value then it gave the results in a flash of second.
All the tables have primary key indexes.
Any ideas what can be done to make this code perform better?
Thanks,
Raj.As suggested I'd try merging the queries into a single SQL. You could also rewrite your IN clauses as JOINs and see if that helps, e.g.
SELECT DISTINCT ai.shipper_ind, ai.special_sales_reserve_ind, ai.exe_location_ind
INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
FROM ah_item ai, ah_item_xref aix, ah_chain_div_facility acdf, ah_div ad
WHERE ai.item_id_edw = aix.item_id_edw
AND aix.item_code_cust = rec.item_code_cust
AND aix.facility_num = acdf.facility_code
AND acdf.chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
AND acdf.div_id = ad.div_id
AND ad.division = rec.division;ALSO: You are calling ah_internal_data_pkg.get_chain_id (p_file_id) every time. Why not do it outside the loop and just use a variable in the inner query? That will prevent context switching and improve speed.
Edited by: Dave Hemming on Dec 3, 2008 9:34 AM -
Performance issue with select query and for all entries.
hi,
i have a report to be performance tuned.
the database table has around 20 million entries and 25 fields.
so, the report fetches the distinct values of two fields using one select query.
so, the first select query fetches around 150 entries from the table for 2 fields.
then it applies some logic and eliminates some entries and makes entries around 80-90...
and then it again applies the select query on the same table using for all entries applied on the internal table with 80-90 entries...
in short,
it accesses the same database table twice.
so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
is around 80-90 entries too much for using "for all entries"?
the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
i really cant find the way out...
please help.chinmay kulkarni wrote:Chinmay,
Even though you tried to ask the question with detailed explanation, unfortunately it is still not clear.
It is perfectly fine to access the same database twice. If that is working for you, I don't think there is any need to change the logic. As Rob mentioned, 80 or 8000 records is not a problem in "for all entries" clause.
>
> so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
>
It is not clear what you tried to do here. Did you try to bring all 20 million records into an internal table? That will certainly cause the program to short dump with memory shortage.
> the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
>
That is fine. Actually, it is better (performance wise) to do much of the work in ABAP than writing a complex WHERE clause that might bog down the database. -
Needed help to improve the performance of a select query?
Hi,
I have been preparing a report which involves data to be fetched from 4 to 5 different tables and calculation has to performed on some columns also,
i planned to write a single cursor to populate 1 temp table.i have used INLINE VIEW,EXISTS more frequently in the select query..please go through the query and suggest me a better way to restructure the query.
cursor c_acc_pickup_incr(p_branch_code varchar2, p_applDate date, p_st_dt date, p_ed_dt date) is
select sca.branch_code "BRANCH",
sca.cust_ac_no "ACCOUNT",
to_char(p_applDate, 'YYYYMM') "YEARMONTH",
sca.ccy "CURRENCY",
sca.account_class "PRODUCT",
sca.cust_no "CUSTOMER",
sca.ac_desc "DESCRIPTION",
null "LOW_BAL",
null "HIGH_BAL",
null "AVG_CR_BAL",
null "AVG_DR_BAL",
null "CR_DAYS",
null "DR_DAYS",
--null "CR_TURNOVER",
--null "DR_TURNOVER",
null "DR_OD_DAYS",
(select sum(gf.limit_amount * (scal.linkage_percentage / 100)) +
(case when (p_applDate >= sca.tod_limit_start_date and
p_applDate <= nvl(sca.tod_limit_end_date, p_applDate)) then
sca.tod_limit else 0 end) dd
from getm_facility gf, sttm_cust_account_linkages scal
where gf.line_code || gf.line_serial = scal.linked_ref_no
and cust_ac_no = sca.cust_ac_no) "OD_LIMIT",
--sc.credit_rating "CR_GRADE",
null "AVG_NET_BAL",
null "UNAUTH_OD_AMT",
sca.acy_blocked_amount "AMT_BLOCKED",
(select sum(amt)
from ictb_entries_history ieh
where ieh.acc = sca.cust_ac_no
and ieh.brn = sca.branch_code
and ieh.drcr = 'D'
and ieh.liqn = 'Y'
and ieh.entry_passed = 'Y'
and ieh.ent_dt between p_st_dt and p_ed_dt
and exists (
select * from ictm_pr_int ipi, ictm_rule_frm irf
where ipi.product_code = ieh.prod
and ipi.rule = irf.rule_id
and irf.book_flag = 'B')) "DR_INTEREST",
(select sum(amt)
from ictb_entries_history ieh
where ieh.acc = sca.cust_ac_no
and ieh.brn = sca.branch_code
and ieh.drcr = 'C'
and ieh.liqn = 'Y'
and ieh.entry_passed = 'Y'
and ieh.ent_dt between p_st_dt and p_ed_dt
and exists (
select * from ictm_pr_int ipi, ictm_rule_frm irf
where ipi.product_code = ieh.prod
and ipi.rule = irf.rule_id
and irf.book_flag = 'B')) "CR_INTEREST",
(select sum(amt) from ictb_entries_history ieh
where ieh.brn = sca.branch_code
and ieh.acc = sca.cust_ac_no
and ieh.ent_dt between p_st_dt and p_ed_dt
and exists (
select product_code
from ictm_product_definition ipd
where ipd.product_code = ieh.prod
and ipd.product_type = 'C')) "FEE_INCOME",
sca.record_stat "ACC_STATUS",
case when (trunc(sca.ac_open_date,'MM') = trunc(p_applDate,'MM')
and not exists (select 1
from ictm_tdpayin_details itd
where itd.multimode_payopt = 'Y'
and itd.brn = sca.branch_code
and itd.acc = sca.cust_ac_no
and itd.multimode_offset_brn is not null
and itd.multimode_tdoffset_acc is not null))
then 1 else 0 end "NEW_ACC_FOR_THE_MONTH",
case when (trunc(sca.ac_open_date,'MM') = trunc(p_applDate,'MM')
and trunc(sc.cif_creation_date,'MM') = trunc(p_applDate,'MM')
and not exists (select 1
from ictm_tdpayin_details itd
where itd.multimode_payopt = 'Y'
and itd.brn = sca.branch_code
and itd.acc = sca.cust_ac_no
and itd.multimode_offset_brn is not null
and itd.multimode_tdoffset_acc is not null))
then 1 else 0 end "NEW_ACC_FOR_NEW_CUST",
(select 1 from dual
where exists (select 1 from ictm_td_closure_renew itcr
where itcr.brn = sca.branch_code
and itcr.acc = sca.cust_ac_no
and itcr.renewal_date = sysdate)
or exists (select 1 from ictm_tdpayin_details itd
where itd.multimode_payopt = 'Y'
and itd.brn = sca.branch_code
and itd.acc = sca.cust_ac_no
and itd.multimode_offset_brn is not null
and itd.multimode_tdoffset_acc is not null)) "RENEWED_OR_ROLLOVER",
(select maturity_date from ictm_acc ia
where ia.brn = sca.branch_code
and ia.acc = sca.cust_ac_no) "MATURITY_DATE",
sca.ac_stat_no_dr "DR_DISALLOWED",
sca.ac_stat_no_cr "CR_DISALLOWED",
sca.ac_stat_block "BLOCKED_ACC", Not Reqd
sca.ac_stat_dormant "DORMANT_ACC",
sca.ac_stat_stop_pay "STOP_PAY_ACC", --New
sca.ac_stat_frozen "FROZEN_ACC",
sca.ac_open_date "ACC_OPENING_DT",
sca.address1 "ADD_LINE_1",
sca.address2 "ADD_LINE_2",
sca.address3 "ADD_LINE_3",
sca.address4 "ADD_LINE_4",
sca.joint_ac_indicator "JOINT_ACC",
sca.acy_avl_bal "CR_BAL",
0 "DR_BAL",
0 "CR_BAL_LCY", t
0 "DR_BAL_LCY",
null "YTD_CR_MOVEMENT",
null "YTD_DR_MOVEMENT",
null "YTD_CR_MOVEMENT_LCY",
null "YTD_DR_MOVEMENT_LCY",
null "MTD_CR_MOVEMENT",
null "MTD_DR_MOVEMENT",
null "MTD_CR_MOVEMENT_LCY",
null "MTD_DR_MOVEMENT_LCY",
'N' "BRANCH_TRFR", --New
sca.provision_amount "PROVISION_AMT",
sca.account_type "ACCOUNT_TYPE",
nvl(sca.tod_limit, 0) "TOD_LIMIT",
nvl(sca.sublimit, 0) "SUB_LIMIT",
nvl(sca.tod_limit_start_date, global.min_date) "TOD_START_DATE",
nvl(sca.tod_limit_end_date, global.max_date) "TOD_END_DATE"
from sttm_cust_account sca, sttm_customer sc
where sca.branch_code = p_branch_code
and sca.cust_no = sc.customer_no
and ( exists (select 1 from actb_daily_log adl
where adl.ac_no = sca.cust_ac_no
and adl.ac_branch = sca.branch_code
and adl.trn_dt = p_applDate
and adl.auth_stat = 'A')
or exists (select 1 from catm_amount_blocks cab
where cab.account = sca.cust_ac_no
and cab.branch = sca.branch_code
and cab.effective_date = p_applDate
and cab.auth_stat = 'A')
or exists (select 1 from ictm_td_closure_renew itcr
where itcr.acc = sca.cust_ac_no
and itcr.brn = sca.branch_code
and itcr.renewal_date = p_applDate)
or exists (select 1 from sttm_ac_stat_change sasc
where sasc.cust_ac_no = sca.cust_ac_no
and sasc.branch_code = sca.branch_code
and sasc.status_change_date = p_applDate
and sasc.auth_stat = 'A')
or exists (select 1 from cstb_acc_brn_trfr_log cabtl
where cabtl.branch_code = sca.branch_code
and cabtl.cust_ac_no = sca.cust_ac_no
and cabtl.process_status = 'S'
and cabtl.process_date = p_applDate)
or exists (select 1 from sttbs_provision_history sph
where sph.branch_code = sca.branch_code
and sph.cust_ac_no = sca.cust_ac_no
and sph.esn_date = p_applDate)
or exists (select 1 from sttms_cust_account_dormancy scad
where scad.branch_code = sca.branch_code
and scad.cust_ac_no = sca.cust_ac_no
and scad.dormancy_start_dt = p_applDate)
or sca.maker_dt_stamp = p_applDate
or sca.status_since = p_applDate
l_tb_acc_det ty_tb_acc_det_int;
l_brnrec cvpks_utils.rec_brnlcy;
l_acbr_lcy sttms_branch.branch_lcy%type;
l_lcy_amount actbs_daily_log.lcy_amount%type;
l_xrate number;
l_dt_rec sttm_dates%rowtype;
l_acc_rec sttm_cust_account%rowtype;
l_acc_stat_row ty_r_acc_stat;
Edited by: user13710379 on Jan 7, 2012 12:18 AMI see it more like shown below (possibly with no inline selects
Try to get rid of the remaining inline selects ( left as an exercise ;) )
and rewrite traditional joins as ansi joins as problems might arise using mixed syntax as I have to leave so I don't have time to complete the query
select sca.branch_code "BRANCH",
sca.cust_ac_no "ACCOUNT",
to_char(p_applDate, 'YYYYMM') "YEARMONTH",
sca.ccy "CURRENCY",
sca.account_class "PRODUCT",
sca.cust_no "CUSTOMER",
sca.ac_desc "DESCRIPTION",
null "LOW_BAL",
null "HIGH_BAL",
null "AVG_CR_BAL",
null "AVG_DR_BAL",
null "CR_DAYS",
null "DR_DAYS",
-- null "CR_TURNOVER",
-- null "DR_TURNOVER",
null "DR_OD_DAYS",
w.dd "OD_LIMIT",
-- sc.credit_rating "CR_GRADE",
null "AVG_NET_BAL",
null "UNAUTH_OD_AMT",
sca.acy_blocked_amount "AMT_BLOCKED",
x.dr_int "DR_INTEREST",
x.cr_int "CR_INTEREST",
y.fee_amt "FEE_INCOME",
sca.record_stat "ACC_STATUS",
case when trunc(sca.ac_open_date,'MM') = trunc(p_applDate,'MM')
and not exists(select 1
from ictm_tdpayin_details itd
where itd.multimode_payopt = 'Y'
and itd.brn = sca.branch_code
and itd.acc = sca.cust_ac_no
and itd.multimode_offset_brn is not null
and itd.multimode_tdoffset_acc is not null
then 1
else 0
end "NEW_ACC_FOR_THE_MONTH",
case when (trunc(sca.ac_open_date,'MM') = trunc(p_applDate,'MM')
and trunc(sc.cif_creation_date,'MM') = trunc(p_applDate,'MM')
and not exists(select 1
from ictm_tdpayin_details itd
where itd.multimode_payopt = 'Y'
and itd.brn = sca.branch_code
and itd.acc = sca.cust_ac_no
and itd.multimode_offset_brn is not null
and itd.multimode_tdoffset_acc is not null
then 1
else 0
end "NEW_ACC_FOR_NEW_CUST",
(select 1 from dual
where exists(select 1
from ictm_td_closure_renew itcr
where itcr.brn = sca.branch_code
and itcr.acc = sca.cust_ac_no
and itcr.renewal_date = sysdate
or exists(select 1
from ictm_tdpayin_details itd
where itd.multimode_payopt = 'Y'
and itd.brn = sca.branch_code
and itd.acc = sca.cust_ac_no
and itd.multimode_offset_brn is not null
and itd.multimode_tdoffset_acc is not null
) "RENEWED_OR_ROLLOVER",
m.maturity_date "MATURITY_DATE",
sca.ac_stat_no_dr "DR_DISALLOWED",
sca.ac_stat_no_cr "CR_DISALLOWED",
-- sca.ac_stat_block "BLOCKED_ACC", --Not Reqd
sca.ac_stat_dormant "DORMANT_ACC",
sca.ac_stat_stop_pay "STOP_PAY_ACC", --New
sca.ac_stat_frozen "FROZEN_ACC",
sca.ac_open_date "ACC_OPENING_DT",
sca.address1 "ADD_LINE_1",
sca.address2 "ADD_LINE_2",
sca.address3 "ADD_LINE_3",
sca.address4 "ADD_LINE_4",
sca.joint_ac_indicator "JOINT_ACC",
sca.acy_avl_bal "CR_BAL",
0 "DR_BAL",
0 "CR_BAL_LCY", t
0 "DR_BAL_LCY",
null "YTD_CR_MOVEMENT",
null "YTD_DR_MOVEMENT",
null "YTD_CR_MOVEMENT_LCY",
null "YTD_DR_MOVEMENT_LCY",
null "MTD_CR_MOVEMENT",
null "MTD_DR_MOVEMENT",
null "MTD_CR_MOVEMENT_LCY",
null "MTD_DR_MOVEMENT_LCY",
'N' "BRANCH_TRFR", --New
sca.provision_amount "PROVISION_AMT",
sca.account_type "ACCOUNT_TYPE",
nvl(sca.tod_limit, 0) "TOD_LIMIT",
nvl(sca.sublimit, 0) "SUB_LIMIT",
nvl(sca.tod_limit_start_date, global.min_date) "TOD_START_DATE",
nvl(sca.tod_limit_end_date, global.max_date) "TOD_END_DATE"
from sttm_cust_account sca,
sttm_customer sc,
(select sca.cust_ac_no
sum(gf.limit_amount * (scal.linkage_percentage / 100)) +
case when p_applDate >= sca.tod_limit_start_date
and p_applDate <= nvl(sca.tod_limit_end_date, p_applDate)
then sca.tod_limit else 0
end
) dd
from sttm_cust_account sca
getm_facility gf,
sttm_cust_account_linkages scal
where gf.line_code || gf.line_serial = scal.linked_ref_no
and cust_ac_no = sca.cust_ac_no
group by sca.cust_ac_no
) w,
(select acc,
brn,
sum(decode(drcr,'D',amt)) dr_int,
sum(decode(drcr,'C',amt)) cr_int
from ictb_entries_history ieh
where ent_dt between p_st_dt and p_ed_dt
and drcr in ('C','D')
and liqn = 'Y'
and entry_passed = 'Y'
and exists(select null
from ictm_pr_int ipi,
ictm_rule_frm irf
where ipi.rule = irf.rule_id
and ipi.product_code = ieh.prod
and irf.book_flag = 'B'
group by acc,brn
) x,
(select acc,
brn,
sum(amt) fee_amt
from ictb_entries_history ieh
where ieh.ent_dt between p_st_dt and p_ed_dt
and exists(select product_code
from ictm_product_definition ipd
where ipd.product_code = ieh.prod
and ipd.product_type = 'C'
group by acc,brn
) y,
ictm_acc m,
(select sca.cust_ac_no,
sca.branch_code
coalesce(nvl2(coalesce(t1.ac_no,t1.ac_branch),'exists',null),
nvl2(coalesce(t2.account,t2.account),'exists',null),
nvl2(coalesce(t3.acc,t3.brn),'exists',null),
nvl2(coalesce(t4.cust_ac_no,t4.branch_code),'exists',null),
nvl2(coalesce(t5.cust_ac_no,t5.branch_code),'exists',null),
nvl2(coalesce(t6.cust_ac_no,t6.branch_code),'exists',null),
nvl2(coalesce(t7.cust_ac_no,t7.branch_code),'exists',null),
decode(sca.maker_dt_stamp,p_applDate,'exists'),
decode(sca.status_since,p_applDate,'exists')
) existence
from sttm_cust_account sca
left outer join
(select ac_no,ac_branch
from actb_daily_log
where trn_dt = p_applDate
and auth_stat = 'A'
) t1
on (sca.cust_ac_no = t1.ac_no
and sca.branch_code = t1.ac_branch
left outer join
(select account,account
from catm_amount_blocks
where effective_date = p_applDate
and auth_stat = 'A'
) t2
on (sca.cust_ac_no = t2.account
and sca.branch_code = t2.branch
left outer join
(select acc,brn
from ictm_td_closure_renew itcr
where renewal_date = p_applDate
) t3
on (sca.cust_ac_no = t3.acc
and sca.branch_code = t3.brn
left outer join
(select cust_ac_no,branch_code
from sttm_ac_stat_change
where status_change_date = p_applDate
and auth_stat = 'A'
) t4
on (sca.cust_ac_no = t4.cust_ac_no
and sca.branch_code = t4.branch_code
left outer join
(select cust_ac_no,branch_code
from cstb_acc_brn_trfr_log
where process_date = p_applDate
and process_status = 'S'
) t5
on (sca.cust_ac_no = t5.cust_ac_no
and sca.branch_code = t5.branch_code
left outer join
(select cust_ac_no,branch_code
from sttbs_provision_history
where esn_date = p_applDate
) t6
on (sca.cust_ac_no = t6.cust_ac_no
and sca.branch_code = t6.branch_code
left outer join
(select cust_ac_no,branch_code
from sttms_cust_account_dormancy
where dormancy_start_dt = p_applDate
) t7
on (sca.cust_ac_no = t7.cust_ac_no
and sca.branch_code = t7.branch_code
) z
where sca.branch_code = p_branch_code
and sca.cust_no = sc.customer_no
and sca.cust_ac_no = w.cust_ac_no
and sca.cust_ac_no = x.acc
and sca.branch_code = x.brn
and sca.cust_ac_no = y.acc
and sca.branch_code = y.brn
and sca.cust_ac_no = m.acc
and sca.branch_code = m.brn
and sca.cust_ac_no = z.sca.cust_ac_no
and sca.branch_code = z.branch_code
and z.existence is not nullRegards
Etbin -
Poor performance due to select query
Hey ppl,
I am facing a problem in one of the select query on BSEG.
The query is as given
TYPES :BEGIN OF wa1_bseg,
bukrs TYPE bseg-bukrs,
belnr TYPE bseg-belnr,
gjahr TYPE bseg-gjahr,
buzei TYPE bseg-buzei,
fwbas TYPE bseg-fwbas ,
pswbt TYPE bseg-pswbt,
hkont TYPE bseg-hkont,
wrbtr TYPE bseg-wrbtr,
ktosl TYPE bseg-ktosl,
koart TYPE bseg-koart,
shkzg TYPE bseg-shkzg,
mwskz TYPE bseg-mwskz,
qsskz TYPE bsis-qsskz,
dmbtr TYPE bseg-dmbtr,
flag TYPE C,
END OF wa1_bseg.
DATA: it_bsegv TYPE TABLE OF wa1_bseg WITH HEADER LINE.
SELECT bukrs belnr gjahr buzei fwbas pswbt hkont wrbtr ktosl shkzg koart mwskz
FROM bseg INTO TABLE it_bsegv
FOR ALL ENTRIES IN it_ekko
WHERE bukrs = 'MU51' AND
gjahr IN s_fiscal AND
valut IN s_budat1 AND
ebeln = it_ekko-ebeln.
Even if there are only around 5 records in it_ekko it takes very long time in executing. Sumtimes it even shows 'time out' in
foreground. Kindly help me out with itHi,
Go through this link it will helpful,
Re: Performance Issue with BKPF, BSEG, BSET
Re: Reading BSEG: performance problems
/people/rob.burbank/blog/2007/11/12/quickly-retrieving-fi-document-data-from-bseg
Regards
Adil
Edited by: Syed Abdul Adil on Jun 17, 2008 12:33 PM -
Need pointers to improve performance of a select query to table vbrk
Hey Folks,
I have a query , whose performance needs to be tuned , as such:
SELECT a~vbeln
a~fkart
a~waerk
a~fkdat
b~posnr
b~vgbel
b~vgpos
b~matnr
b~arktx
b~prctr
b~txjcd
INTO TABLE gi_billing_items
FROM vbrk AS a
INNER JOIN vbrp AS b
ON a~vbeln = b~vbeln
FOR ALL ENTRIES IN gi_sales_items
WHERE b~vgbel = gi_sales_items-vbeln
AND b~vgpos = gi_sales_items-posnr
AND b~matnr = gi_sales_items-matnr
AND b~werks = gi_sales_items-werks.
where
gi_sales_items is an internal table consisting of 278 entries,.
The result set collected in table gi_billing_items is 200 records
The total execution time for this query for the afore given data is 72,983 ms with the average time/record being ~ 9,471 ms which is too high.
When I try to verify the Explain Plan of the query in ST05, in the Access path I see that the performance of Query Block 1 is bad. Query Block 1 is of the QBLOCK_TYPE UNIONA. Its the very first step in the Query execution internally.
The indexes are defined on participating tables VBRK and VBRP as:
VBRK~0 MANDT,VBELN
VBRK~LOC MANDT,LCNUM
VBRP~0 MANDT,VBELN,POSNR
VBRP~Z01 FPLNR,MANDT
VBRP~Z02 MANDT,MATNR,WERKS
Its clear from the ST05, STAD and SE30 traces that there is a performance issue in this query. Does anyone have any pointers as to how to resolve this issue? Is there a protocol one needs to follow when using the "FOR ALL ENTRIES IN" clause? Or is there a need for any secondary indexes to be created?
Please let me know
Thanks and Best Regards,
Rashmi.Hi,
Try using the VBFA...to get the Invoice number and line item..and then use that value in VBRK...
* Declare the internal table for T_VBFA.
IF NOT gi_sales_items[] IS INITIAL.
SELECT VBELV
POSNV
VBELN
POSNN
VBTYP_N
INTO TABLE T_VBFA
FOR ALL ENTRIES IN gi_sales_items
WHERE VBELV = gi_sales_items-VBELN
AND POSNV = gi_sales_items-POSNR
AND VBTYP_N = 'M'. "Invoice ""Added this..
ENDIF.
**Add two columns to GI_SALES_ITEMS..to store the VBELN POSNN the data from t_vbfa..let's assume it is VBELN_VF and POSNR_VF
* Basically merge gi_sales_items AND t_vbfa
** Then use that field in
IF NOT GI_SALES_ITEMS[] IS INITIAL.
SELECT a~vbeln
a~fkart
a~waerk
a~fkdat
b~posnr
b~vgbel
b~vgpos
b~matnr
b~arktx
b~prctr
b~txjcd
INTO TABLE gi_billing_items
FROM vbrk AS a
INNER JOIN vbrp AS b
ON a~vbeln = b~vbeln
FOR ALL ENTRIES IN gi_sales_items
WHERE b~vbeln = gi_sales_items-vbeln_vf " Change here
AND b~posnr = gi_sales_items-posnr_vf " Change here
AND b~matnr = gi_sales_items-matnr
AND b~werks = gi_sales_items-werks.
ENDIF.
Thanks
Naren
Edited by: Narendran Muthukumaran on Oct 15, 2008 11:35 PM -
Performance of the select query
i want to know wheter the conversion of the select query
SELECT * FROM mchb
WHERE matnr EQ mch1-matnr
AND charg EQ mch1-charg
AND werks EQ plant-werks.
itab-lgort = mchb-lgort.
itab-clabs = mchb-clabs.
APPEND itab.
ENDSELECT.
into following pattern
select lgort clabs
from mchb
into corresponding fields of itab
WHERE matnr EQ mch1-matnr
AND charg EQ mch1-charg
AND werks EQ plant-werks.
ENDSELECT.
will give the same results ?Hi,
It will results in performance issue because of end select statement.
select lgort clabs
from mchb
into table itab
WHERE matnr EQ mch1-matnr
AND charg EQ mch1-charg
AND werks EQ plant-werks.
Use like this you will get the values of lgort and clabs in the internal table itab.
Then use loop statement to use that values further.
Dont use end select it will be a performance issue.
In this code there is no need to use of ENDSELECT and use corresponding fields of table itab.
select lgort clabs
from mchb
into corresponding fields of itab
WHERE matnr EQ mch1-matnr
AND charg EQ mch1-charg
AND werks EQ plant-werks.
ENDSELECT.
Thanks,
Sakthi -
How to optimize the below select query
SELECT mvke~matnr "Material Number
mbew~bwkey "Plant
mvke~mvgr1 "Line of Business
mara~meins "Unit of measure
mara~ntgew "Net weight
mara~mhdrz "Remaining shelf life
mara~zzmax_exp_days "Max expiry days
makt~maktx "Material Description
tvm1t~bezei "Line of Business description
mbew~stprs "Standard price
mbew~vprsv "Price control (S/V)
mbew~verpr "Variable Price
FROM mvke INNER JOIN mara
ON maramatnr EQ mvkematnr
INNER JOIN makt
ON maktmatnr EQ mvkematnr
INNER JOIN tvm1t
ON tvm1tmvgr1 EQ mvkemvgr1
INNER JOIN mbew
ON mbewmatnr EQ maramatnr
AND
mbewbwkey EQ mvkevkorg
INTO TABLE gt_matdata
WHERE mbew~matnr IN s_matnr AND
mbew~bwkey IN s_werks AND
mvke~mvgr1 IN s_mvgr1 AND
makt~spras EQ sy-langu AND
tvm1t~spras EQ sy-langu.
Please advice.
Thanks and Regards
Syed SamdaniHi,
You are taking different fields of data from five different tables it seems.
Well you can take separate internal tables and fire five separate select queries using the 'For All Entries' condition after the first select stmnt, so that u get all the related data. Then take your final internal table and merge all data from all these five internal tables into you final table.
Regards,
Jayadeep -
Performance issue with select query
Hi friends ,
This is my select query which is taking so much time to retrive the records.CAn Any one help me in solving this performance issue.
*- Get the Goods receipts mainly selected per period (=> MKPF secondary
SELECT msegebeln msegebelp mseg~werks
ekkobukrs ekkolifnr ekkozterm ekkoekorg ekko~ekgrp
ekkoinco1 ekkoexnum
lfa1name1 lfa1land1 lfa1ktokk lfa1stceg
mkpfmblnr mkpfmjahr msegzeile mkpfbldat mkpf~budat
mseg~bwart
*Start of changes for CIP 6203752 by PGOX02
mseg~smbln
*End of changes for CIP 6203752 by PGOX02
ekpomatnr ekpotxz01 ekpomenge ekpomeins
ekbemenge ekbedmbtr ekbewrbtr ekbewaers
ekpolgort ekpomatkl ekpowebaz ekpokonnr ekpo~ktpnr
ekpoplifz ekpobstae
INTO TABLE it_temp
FROM mkpf JOIN mseg ON msegmblnr EQ mkpfmblnr
AND msegmjahr EQ mkpfmjahr
JOIN ekbe ON ekbeebeln EQ msegebeln
AND ekbeebelp EQ msegebelp
AND ekbe~zekkn EQ '00'
AND ekbe~vgabe EQ '1'
AND ekbegjahr EQ msegmjahr
AND ekbebelnr EQ msegmblnr
AND ekbebuzei EQ msegzeile
JOIN ekpo ON ekpoebeln EQ ekbeebeln
AND ekpoebelp EQ ekbeebelp
JOIN ekko ON ekkoebeln EQ ekpoebeln
JOIN lfa1 ON lfa1lifnr EQ ekkolifnr
WHERE mkpf~budat IN so_budat
AND mkpf~bldat IN so_bldat
AND mkpf~vgart EQ 'WE'
AND mseg~bwart IN so_bwart
AND mseg~matnr IN so_matnr
AND mseg~werks IN so_werks
AND mseg~lifnr IN so_lifnr
AND mseg~ebeln IN so_ebeln
AND ekko~ekgrp IN so_ekgrp
AND ekko~bukrs IN so_bukrs
AND ekpo~matkl IN so_matkl
AND ekko~bstyp IN so_bstyp
AND ekpo~loekz EQ space
AND ekpo~plifz IN so_plifz.
Thanks & Regards,
Manoj Kumar .Thatha
Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting and please use code tags when posting code - post locked
Edited by: Rob Burbank on Feb 4, 2010 9:03 AMHi friends ,
This is my select query which is taking so much time to retrive the records.CAn Any one help me in solving this performance issue.
*- Get the Goods receipts mainly selected per period (=> MKPF secondary
SELECT msegebeln msegebelp mseg~werks
ekkobukrs ekkolifnr ekkozterm ekkoekorg ekko~ekgrp
ekkoinco1 ekkoexnum
lfa1name1 lfa1land1 lfa1ktokk lfa1stceg
mkpfmblnr mkpfmjahr msegzeile mkpfbldat mkpf~budat
mseg~bwart
*Start of changes for CIP 6203752 by PGOX02
mseg~smbln
*End of changes for CIP 6203752 by PGOX02
ekpomatnr ekpotxz01 ekpomenge ekpomeins
ekbemenge ekbedmbtr ekbewrbtr ekbewaers
ekpolgort ekpomatkl ekpowebaz ekpokonnr ekpo~ktpnr
ekpoplifz ekpobstae
INTO TABLE it_temp
FROM mkpf JOIN mseg ON msegmblnr EQ mkpfmblnr
AND msegmjahr EQ mkpfmjahr
JOIN ekbe ON ekbeebeln EQ msegebeln
AND ekbeebelp EQ msegebelp
AND ekbe~zekkn EQ '00'
AND ekbe~vgabe EQ '1'
AND ekbegjahr EQ msegmjahr
AND ekbebelnr EQ msegmblnr
AND ekbebuzei EQ msegzeile
JOIN ekpo ON ekpoebeln EQ ekbeebeln
AND ekpoebelp EQ ekbeebelp
JOIN ekko ON ekkoebeln EQ ekpoebeln
JOIN lfa1 ON lfa1lifnr EQ ekkolifnr
WHERE mkpf~budat IN so_budat
AND mkpf~bldat IN so_bldat
AND mkpf~vgart EQ 'WE'
AND mseg~bwart IN so_bwart
AND mseg~matnr IN so_matnr
AND mseg~werks IN so_werks
AND mseg~lifnr IN so_lifnr
AND mseg~ebeln IN so_ebeln
AND ekko~ekgrp IN so_ekgrp
AND ekko~bukrs IN so_bukrs
AND ekpo~matkl IN so_matkl
AND ekko~bstyp IN so_bstyp
AND ekpo~loekz EQ space
AND ekpo~plifz IN so_plifz.
Thanks & Regards,
Manoj Kumar .Thatha
Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting and please use code tags when posting code - post locked
Edited by: Rob Burbank on Feb 4, 2010 9:03 AM -
Performance improvement for select query
Hi all,
need to improve performace for the below select query as it is taking long time
SELECT vbeln pdstk
FROM vbuk INTO TABLE it_vbuk1 FOR ALL ENTRIES IN it_likp
WHERE vbeln = it_likp-vbeln AND
wbstk = 'C' AND "pdstk = ' ' AND
vbtyp IN gr_delivery AND
( fkstk = 'A' OR fkstk = 'B' ) OR
( fkivk = 'A' OR fkivk = 'B' ).
Regards,
KumarHi,
Check if it_likp is sorted on vbeln.
SELECT vbeln pdstk
FROM vbuk INTO TABLE it_vbuk1 FOR ALL ENTRIES IN it_likp
WHERE vbeln = it_likp-vbeln AND
wbstk = 'C' AND
vbtyp IN gr_delivery AND
( ( fkstk = 'A' OR fkstk = 'B' ) OR <-- check this condition , if ( ) is needed ...
( fkivk = 'A' OR fkivk = 'B' ) ) .
Regards,
Srini. -
Performance issue in Select Query on ERCH
Dear Friends,
I have to execute a query on ERCH in production system having around 20 lakh data which keeps on increasing. "Select BELNR VERTRAG ADATSOLL from ERCH where BCREASON = u201803u2019 " . The expected volume of data that the query will return is approx 1400 records.
Since the where clause includes a field which is not a key field please suggest the performance of the query so that it doesn't time-out.
Regards,
Amit SrivastavaHello Amit Srivastava ,
You can add the Contract account number(VKONT) and Business Partner number(GPARTNER) in your query and can create a custom Index for the contract account number (We have this index created in our system).
This will improve the performance effectively.
Hope this answers your question.
Thanks,
Greetson -
Hi,
Following query is taking about 30-40 mins to fetch the data in a procedure.I tried using the hints and ran the explain plan but the cost is still the same (151,894) . Can anyone please help me in tuning the query.
SELECT SYSDATE c_creation_date, glcc.code_combination_id c_ccid,
glcc.segment1 c_funding, glcc.segment2 c_resp_ctr,
glcc.segment3 c_account, glcc.segment4 c_pgm_phase,
glcc.segment5 c_project_cd, null c_vendor_id,
null c_vendor_num, null c_vendor_name,
null c_site_code,
null c_vendor_type,
null c_project_id, null c_project,
null c_project_name,
null c_organization_id,
null c_organization, null c_expenditure_type_id,
null c_expenditure_type,
null c_task_id, null c_task,
null c_task_name, null c_award_id,
null c_award, null c_award_name,
jel.je_header_id c_document_batch_id,
jeh.name c_document_batch_name,
-- jel.reference_2 c_document_id, --- Note: reference_2 invoice_id,po_header_id,req_header_id
case
when je_source = 'Purchasing'
then jel.reference_2
when je_source = 'Payables'
then jel.reference_2
else null
end c_document_id,
case
when je_source = 'Purchasing'
then 'GLJE-'||je_source||' '||jel.reference_1
else 'GLJE-'||je_source
end c_document_type,
case
when je_source = 'Payables'
then jel.reference_5
when je_source = 'Purchasing'
then reference_4
else
reference_4
end c_document_number,
NULL c_document_release_id, NULL c_document_release,
NULL c_document_line_id,
null c_document_line_num,
case
when je_source = 'Purchasing'
then jel.reference_3
else null
end c_document_dist_id,
case
when je_source = 'Payables'
then jel.reference_3
else null
end c_document_dist_num,
0 c_distr_amount,
(nvl(accounted_dr,0) - nvl(accounted_cr,0)) c_encumbered_amount,
0,0,0,0,0,0,NULL,jel.je_line_num c_je_line_num
FROM gl_je_lines jel,
gl_je_headers jeh,
gl_encumbrance_types jee ,
gl_code_combinations glcc
WHERE jel.je_header_id = jeh.je_header_id
AND jel.CODE_COMBINATION_ID = glcc.CODE_COMBINATION_ID
AND jee.encumbrance_type_id = jeh.encumbrance_type_id
AND actual_flag = 'E'
and glcc.segment1
|| '-'
|| glcc.segment2
|| '-'
|| glcc.segment3
|| '-'
|| glcc.segment4
|| '-'
|| glcc.segment5
|| '-'
|| glcc.segment6
|| '-'
|| glcc.segment7 between nvl(:p_min_flex, :l_min_flex) and nvl(:p_max_flex,: l_max_flex )
and encumbrance_type = nvl(:l_enc_type,encumbrance_type)
and jel.EFFECTIVE_DATE between nvl(:p_encumbrance_date_from,:l_date_low)
and nvl(:p_encumbrance_date_to,:l_date_high)
and decode(je_source,'Purchasing',jel.reference_4,'Payables',jel.reference_5)
=nvl(:l_doc_number,decode(je_source,'Purchasing',jel.reference_4,'Payables',jel.reference_5))
and je_source != 'Payables';
I will appreciate the help!
Regards,
DarshiniHi,
Thanks Sundar and Miguel for the article, it is very helpful.
I was able to get the output from explain plan as well as sql_trace.But I could not understand how to compare the files and optimize the query. follwing are the outputs
select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 2 | 336 | 151K|
| 1 | CONCATENATION | | | | |
| 2 | FILTER | | | | |
| 3 | NESTED LOOPS | | 1 | 168 | 54873 |
| 4 | NESTED LOOPS | | 1 | 155 | 54872 |
| 5 | NESTED LOOPS | | 1633 | 180K| 53237 |
| 6 | TABLE ACCESS FULL | GL_CODE_COMBINATIONS | 1387 | 77672 | 3713 |
| 7 | TABLE ACCESS BY INDEX ROWID| GL_JE_LINES | 1 | 57 | 66 |
| 8 | INDEX RANGE SCAN | GL_JE_LINES_N1 | 135 | | 3 |
| 9 | TABLE ACCESS BY INDEX ROWID | GL_JE_HEADERS | 1 | 42 | 1 |
| 10 | INDEX UNIQUE SCAN | GL_JE_HEADERS_U1 | 1 | | 0 |
| 11 | TABLE ACCESS BY INDEX ROWID | GL_ENCUMBRANCE_TYPES | 1 | 13 | 1 |
| 12 | INDEX UNIQUE SCAN | GL_ENCUMBRANCE_TYPES_U1 | 1 | | 0 |
| 13 | FILTER | | | | |
| 14 | NESTED LOOPS | | 1 | 168 | 97021 |
| 15 | NESTED LOOPS | | 1633 | 200K| 95386 |
| 16 | NESTED LOOPS | | 1387 | 95703 | 3714 |
PLAN_TABLE_OUTPUT
| 17 | TABLE ACCESS BY INDEX ROWID| GL_ENCUMBRANCE_TYPES | 1 | 13 | 1 |
| 18 | INDEX UNIQUE SCAN | GL_ENCUMBRANCE_TYPES_U2 | 1 | | 0 |
| 19 | TABLE ACCESS FULL | GL_CODE_COMBINATIONS | 1387 | 77672 | 3713 |
| 20 | TABLE ACCESS BY INDEX ROWID | GL_JE_LINES | 1 | 57 | 66 |
| 21 | INDEX RANGE SCAN | GL_JE_LINES_N1 | 135 | | 3 |
| 22 | TABLE ACCESS BY INDEX ROWID | GL_JE_HEADERS | 1 | 42 | 1 |
| 23 | INDEX UNIQUE SCAN | GL_JE_HEADERS_U1 | 1 | | 0 |
sql_trace
PARSING IN CURSOR #2 len=3812 dep=0 uid=173 oct=3 lid=173 tim=3338840240188 hv=2038351921 ad='aaf94e98'
SELECT SYSDATE c_creation_date, glcc.code_combination_id c_ccid ,
glcc.segment1 c_funding, glcc.segment2 c_resp_ctr,
glcc.segment3 c_account, glcc.segment4 c_pgm_phase,
glcc.segment5 c_project_cd, null c_vendor_id,
null c_vendor_num, null c_vendor_name,
null c_site_code,
null c_vendor_type,
null c_project_id, null c_project,
null c_project_name,
null c_organization_id,
null c_organization, null c_expenditure_type_id,
null c_expenditure_type,
null c_task_id, null c_task,
null c_task_name, null c_award_id,
null c_award, null c_award_name,
jel.je_header_id c_document_batch_id,
jeh.name c_document_batch_name,
case
when je_source = 'Purchasing'
then jel.reference_2
when je_source = 'Payables'
then jel.reference_2
else null
end c_document_id,
case
when je_source = 'Purchasing'
then 'GLJE-'||je_source||' '||jel.reference_1
else 'GLJE-'||je_source
end c_document_type,
case
when je_source = 'Payables'
then jel.reference_5
when je_source = 'Purchasing'
then reference_4
else
reference_4
end c_document_number,
NULL c_document_release_id, NULL c_document_release,
NULL c_document_line_id,
null c_document_line_num,
case
when je_source = 'Purchasing'
then jel.reference_3
else null
end c_document_dist_id,
case
when je_source = 'Payables'
then jel.reference_3
else null
end c_document_dist_num,
0 c_distr_amount,
(nvl(accounted_dr,0) - nvl(accounted_cr,0)) c_encumbered_amount,
0,0,0,0,0,0,NULL,jel.je_line_num c_je_line_num
FROM gl_je_lines jel,
gl_je_headers jeh,
gl_encumbrance_types jee ,
gl_code_combinations glcc
WHERE jel.je_header_id = jeh.je_header_id
AND jel.CODE_COMBINATION_ID = glcc.CODE_COMBINATION_ID
AND jee.encumbrance_type_id = jeh.encumbrance_type_id
AND actual_flag = 'E'
and glcc.segment1
|| '-'
|| glcc.segment2
|| '-'
|| glcc.segment3
|| '-'
|| glcc.segment4
|| '-'
|| glcc.segment5
|| '-'
|| glcc.segment6
|| '-'
|| glcc.segment7 between nvl(null,'F017-M029300-1980200200-CF2004-000000-00000-00000')
and nvl(null,'F017-M029300-1980200200-CF2004-000000-00000-00000' )
and encumbrance_type = nvl('Obligation',encumbrance_type)
and jel.EFFECTIVE_DATE between nvl(null,'01-JAN-1900')
and nvl(null,'31-DEC-4712')
and decode(je_source,'Purchasing',jel.reference_4,'Payables',jel.reference_5)
=nvl('5013794',decode(je_source,'Purchasing',jel.reference_4,'Payables',jel.reference_5))
and je_source != 'Payables'
END OF STMT
PARSE #2:c=50000,e=42317,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=3338840240172
EXEC #2:c=0,e=621,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=3338840243240
FETCH #2:c=5910000,e=5837875,p=13246,cr=19198,cu=0,mis=0,r=1,dep=0,og=1,tim=3338846081769
FETCH #2:c=0,e=1166,p=0,cr=8,cu=0,mis=0,r=15,dep=0,og=1,tim=3338846086521
*** 2008-08-06 12:24:18.016
FETCH #2:c=10000,e=2155,p=0,cr=21,cu=0,mis=0,r=15,dep=0,og=1,tim=3338854116887
FETCH #2:c=0,e=1812,p=0,cr=14,cu=0,mis=0,r=15,dep=0,og=1,tim=3338860800729
*** 2008-08-06 12:24:31.298
FETCH #2:c=10000,e=1729,p=0,cr=10,cu=0,mis=0,r=15,dep=0,og=1,tim=3338867087393
FETCH #2:c=0,e=1810,p=0,cr=14,cu=0,mis=0,r=15,dep=0,og=1,tim=3338872996057
*** 2008-08-06 12:24:43.317
FETCH #2:c=0,e=1728,p=0,cr=9,cu=0,mis=0,r=15,dep=0,og=1,tim=3338878825390
FETCH #2:c=0,e=2058,p=0,cr=12,cu=0,mis=0,r=15,dep=0,og=1,tim=3338884698870
*** 2008-08-06 12:24:57.286
FETCH #2:c=0,e=2095,p=0,cr=10,cu=0,mis=0,r=10,dep=0,og=1,tim=3338892467618
STAT #2 id=1 cnt=116 pid=0 pos=1 obj=0 op='HASH JOIN (cr=19296 pr=13246 pw=0 time=5837597 us)'
STAT #2 id=2 cnt=5464 pid=1 pos=1 obj=33979 op='TABLE ACCESS FULL GL_JE_HEADERS (cr=6120 pr=183 pw=0 time=796948 us)'
STAT #2 id=3 cnt=174 pid=1 pos=2 obj=34028 op='TABLE ACCESS BY INDEX ROWID GL_JE_LINES (cr=13176 pr=13063 pw=0 time=5576761 us)'
STAT #2 id=4 cnt=176 pid=3 pos=1 obj=0 op='NESTED LOOPS (cr=13088 pr=13063 pw=0 time=487814114 us)'
STAT #2 id=5 cnt=1 pid=4 pos=1 obj=0 op='MERGE JOIN CARTESIAN (cr=13076 pr=13063 pw=0 time=5575083 us)'
STAT #2 id=6 cnt=1 pid=5 pos=1 obj=34354 op='TABLE ACCESS FULL GL_ENCUMBRANCE_TYPES (cr=6 pr=0 pw=0 time=453 us)'
STAT #2 id=7 cnt=1 pid=5 pos=2 obj=0 op='BUFFER SORT (cr=13070 pr=13063 pw=0 time=5574591 us)'
STAT #2 id=8 cnt=1 pid=7 pos=1 obj=33834 op='TABLE ACCESS FULL GL_CODE_COMBINATIONS (cr=13070 pr=13063 pw=0 time=5573921 us)'
STAT #2 id=9 cnt=174 pid=4 pos=2 obj=34055 op='INDEX RANGE SCAN GL_JE_LINES_N1 (cr=12 pr=0 pw=0 time=349 us)'
=====================
I will greatly appreciate if any one can help me further.
Thanks,
Darshini -
Performance problem at Select Query
Hello all,
I have a performance question. Which code can i use instead of this code
" select * from t001a into table it_tp_auth where bukrs in kd_bukrs ".
thus the program runs faster ?
Regards
HeidiHi all,
that was my estimation. But I go into wrong direction.
I must TC : FB1lN optimize.
My Problem:
if I select my interval for company code largely, the program (RFITEMAP) is very slow. What I can make in this report, so that preformance becomes better.
Example: ( selection criterion )
company code : 1 to 200 -
> very slow
company code: 1 ---> normal
My estimation:
if I write a report, with same selection screen. In this report
can I call with (Submit) FBL1N and transfer all entered values to FBL1N ?
report:
report dummy.
tables: lfa.
select-options: bukrs for lfa-bukrs.
start-of-selection.
loop at bukrs into wa_bukrs.
SUBMIT FBL1N with p_param1 =wa_bukrs.
endloop.
is this realizable ?
best regards
Heidi
Edited by: Heidi Heinzberger on Sep 16, 2008 10:13 PM
Maybe you are looking for
-
New to iPhoto-organizing photos?
Transferring years worth of photos from my PC. I had everything filed by year with subfolders. Can I do that with iPhotos?
-
USB mouse not working in Windows 8
I have Win8 64-bit OS. A couple of days back the USB mouse stopped working without any reason. The mouse works on other systems and there is nothing wrong with the hardware. I found a couple of posts suggesting uninstalling the drivers or doing a sys
-
Hi Friends, Can someone tell which is the common data source which we use to get the cost/selling price of a particular material?? thanks in advance,
-
Form Attachment for FI Invoice
Hi Is there a place where we can attach a form for printing FI Invoices. I gather that in SD, in config there is a transaction where a customized form maybe attached- do we have any such thing in FI too? Thank you Rukshana
-
Time Capsule as simply external HD.
First of all sorry for my bad english. I would like to know if time capsule can be used as a simple external drive (obviously as WIFI drive), I mean like I actually use my LaCie external drive. Or just can be used to backup files with iBackup or time