Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Performance SQL - Indexing

Former Member
0 Likes
433

Hi Experts,

I hv 2 different SQLs in same prog., like,

<i>SELECT DISTINCT bname

INTO TABLE bname_itab

FROM vbak

WHERE ernam IN s_ernam

AND bname NE space

AND auart IN s_auart

AND vkorg IN s_org

AND vtweg IN s_d_ch

AND spart IN s_div.</i>

SELECT vbeln into vbeln_itab

from vbak

where kunnr = s_kunnr

and kvgr2 = kvgr2.

So,

Already I hv one secondary index as Z02 for ernamauartvkorgvtwegspart

So, (performance point of view)

1 - Shuld I add kuunr + kvgr2 to the existing Z02 index?

2 - OR shalll I create a new one as Z03 with kunnr + kvgr2?

thanq.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
387

Have you used the 'explain' function of ST05 to make sure that it is using the index for the first SELECT? The NE is going to cause problems.

Rob

2 REPLIES 2
Read only

Former Member
0 Likes
388

Have you used the 'explain' function of ST05 to make sure that it is using the index for the first SELECT? The NE is going to cause problems.

Rob

Read only

0 Likes
387

ThanQ Rob,

No, I did not see the EXPLAIN function, will go thru it.

But, pls. let me clarify that,

How the NE operator in bname NE space, creates a problem?

thanq.