‎2007 Aug 07 2:51 PM
Hi all,
I have a performance issue with the following query.
SELECT * FROM z2rlresurrect
INTO TABLE ts_z2rlresurrect
FOR ALL ENTRIES IN ts_zzumicur_copy
WHERE ( zzumicur = ts_zzumicur_copy-zzumicur OR
resurrected_umi = ts_zzumicur_copy-zzumicur ).
In the table z2rlresurrect zzumicur is a key and resurrected_umi is an indexed field.When i did the trace its not using the index while selecting.
Problem is it taking too much time when there are no records exists for a ts_zzumicur_copy.
Any help will be appreciated.
Thanks
Sukumar.
‎2007 Aug 07 2:56 PM
Hi,
before using this query ,put an if condition i.e.
if sy-subrc = 0.
select * ...........................
endif.
Hope this helps.
Reward if helpful.
Regards,
Sipra
‎2007 Aug 07 2:56 PM
Hi,
before using this query ,put an if condition i.e.
if sy-subrc = 0.
select * ...........................
endif.
Hope this helps.
Reward if helpful.
Regards,
Sipra
‎2007 Aug 07 3:00 PM
Hi,
My problem is if no records exists for the internal table ts_zzumicur_copy entries in the database table z2rlresurrect.
for ex if internal table has 200 records if it doesnt fina an entry in z2rlresurrect...it taking too much time.
I hope now its clear
‎2007 Aug 07 2:57 PM
‎2007 Aug 07 2:59 PM
Hi,
Change this way
if not ts_zzumicur_copy[] is initial. << Check for entries
SELECT * FROM z2rlresurrect
INTO TABLE ts_z2rlresurrect
FOR ALL ENTRIES IN ts_zzumicur_copy
WHERE ( zzumicur = ts_zzumicur_copy-zzumicur OR
resurrected_umi = ts_zzumicur_copy-zzumicur ).
endif.
aRs
‎2007 Aug 07 3:00 PM
Hi sukumar
if ts_zzumicur_copy[] is not initial.
SELECT * FROM z2rlresurrect
INTO TABLE ts_z2rlresurrect
FOR ALL ENTRIES IN ts_zzumicur_copy
WHERE ( zzumicur = ts_zzumicur_copy-zzumicur OR
resurrected_umi = ts_zzumicur_copy-zzumicur ).
endif.
u cannot use if the internal table is empty in for all entries
if u use there is no use that selects all the records .
Rewards points for helpful answers,
kiran.M
‎2007 Aug 07 3:01 PM
I wonder if you may be better to split the select as the 'OR' statement may be causing the performance issue.
‎2007 Aug 07 3:05 PM
Iam checking as you guys said infact my code is.
CHECK NOT ts_zzumicur[] IS INITIAL AND s_zzumi[] IS INITIAL.
ts_zzumicur_copy[] = ts_zzumicur[].
break pulleps.
SELECT * FROM z2rlresurrect
INTO TABLE ts_z2rlresurrect
FOR ALL ENTRIES IN ts_zzumicur_copy
WHERE ( zzumicur = ts_zzumicur_copy-zzumicur OR
resurrected_umi = ts_zzumicur_copy-zzumicur ).
‎2007 Aug 07 3:16 PM
CHECK NOT ts_zzumicur[] IS INITIAL .
check s_zzumi[] IS INITIAL.
ts_zzumicur_copy[] = ts_zzumicur[].
SELECT Field1 field2 FROM z2rlresurrect
INTO TABLE ts_z2rlresurrect
FOR ALL ENTRIES IN ts_zzumicur_copy
WHERE ( zzumicur = ts_zzumicur_copy-zzumicur OR
resurrected_umi = ts_zzumicur_copy-zzumicur ).
Thanks
Mahesh
‎2007 Aug 07 3:17 PM
hi
when ever ur useing for all entries
you have to check the above select query
is it retriving any data or not
if not ts_zzumicur_copy[] is initial
SELECT * FROM z2rlresurrect
INTO TABLE ts_z2rlresurrect
FOR ALL ENTRIES IN ts_zzumicur_copy
WHERE ( zzumicur = ts_zzumicur_copy-zzumicur OR
resurrected_umi = ts_zzumicur_copy-zzumicur ).
endif.
rewrd if usefull
‎2007 Aug 07 3:18 PM
hi
if use for all entries
if there is no matches for the given condition then it will retrive all the data
if u write like above
then it won't allow that
‎2007 Aug 07 3:23 PM
‎2007 Aug 07 3:31 PM
Have you tried what I said.
'I wonder if you may be better to split the select as the 'OR' statement may be causing the performance issue'
Have two different SQL statements using a single where condition instead of the 'OR' command'.
‎2007 Aug 07 3:51 PM
1-If for entries internal table is empty, do not select
2-Break the select with 'OR' in two select. The or on two distinct field don't help the SQL optimizer (at least)
SELECT *
FROM z2rlresurrect
INTO TABLE ts_z2rlresurrect
FOR ALL ENTRIES IN ts_zzumicur_copy
WHERE zzumicur = ts_zzumicur_copy-zzumicur.
SELECT *
FROM z2rlresurrect
APPENDING TABLE ts_z2rlresurrect
FOR ALL ENTRIES IN ts_zzumicur_copy
WHERE resurrected_umi = ts_zzumicur_copy-zzumicur
AND zzumicur <> ts_zzumicur_copy-zzumicur.If the performance problem continues, are the fields "zzumicur" and "resurrected_umi" first key (after client) of TWO primary or alternative indexes (ie zzumicur on primary index, and an index with resurrected_umi is active in database)
Regards
‎2007 Aug 07 4:12 PM
HI,
I do the changes as you suggested and get back to you
Thanks
sai.