Application Development 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: 

Regardaing secondary index

spandana_babu
Participant
0 Kudos

hi all,

i want to create the secondary index on mseg table.

here i am having select stament like this...

which fields can i select in the secondary index.

give me a brief explain.

SELECT MSEG~MBLNR

MSEG~BWART

MSEG~WERKS

MSEG~SHKZG

MSEG~MATNR

MSEG~ERFMG

MSEG~UMWRK

MKPF~MBLNR

MKPF~BUDAT

MSEG~XAUTO

MSEG~EBELN

INTO TABLE I_3MSEG

FROM MSEG

INNER JOIN MKPF

ON MSEGMBLNR = MKPFMBLNR

WHERE MSEG~BWART IN ('301')

AND MSEG~MATNR IN S_MATNR

AND MSEG~WERKS IN S_SPLANT

AND MSEG~UMWRK IN S_RPLANT

AND MKPF~BUDAT IN S_AEDAT

AND MSEG~XAUTO <> 'X'

AND MSEG~EBELN IN S_EBELN.

Regards..

Anand.N

1 ACCEPTED SOLUTION

former_member194613
Active Contributor
0 Kudos

I can not see how it is possible to answer your question with your information:

Yoou need to run the SQL trace and ypou need to check which of your IN-clauses are actually filled (see details).

Then you need to checkk the explain, what index is used, and what indexes are also there. Then you could figure out, whether there is another index, either existing or not, which could even be better.

Siegfried

4 REPLIES 4

Former Member
0 Kudos

hi

u r primary keys r ON MSEGMBLNR = MKPFMBLNR

WHERE MSEG~BWART IN ('301')

AND MSEG~MATNR IN S_MATNR

AND MSEG~WERKS IN S_SPLANT

AND MSEG~UMWRK IN S_RPLANT

AND MKPF~BUDAT IN S_AEDAT

AND MSEG~XAUTO <> 'X'

AND MSEG~EBELN IN S_EBELN.

ok

u can selectany fieds as a secondary index apart from this primary key fields .means ather than primary key values.

ok

Former Member
0 Kudos

No need to create another secondary index. You are already using enough of secondary index MSEG~M.

Rob

former_member194613
Active Contributor
0 Kudos

I can not see how it is possible to answer your question with your information:

Yoou need to run the SQL trace and ypou need to check which of your IN-clauses are actually filled (see details).

Then you need to checkk the explain, what index is used, and what indexes are also there. Then you could figure out, whether there is another index, either existing or not, which could even be better.

Siegfried

former_member194613
Active Contributor
0 Kudos

Please read my answer more carefully, use the SQL, check the details of the statement check what values are filled and onyl then you can decide which

index is optimal:

see

/people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy

Siegfried