12-08-2007 5:28 AM
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
12-10-2007 9:25 AM
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
12-08-2007 9:03 AM
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
12-08-2007 5:39 PM
No need to create another secondary index. You are already using enough of secondary index MSEG~M.
Rob
12-10-2007 9:25 AM
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
12-12-2007 1:52 PM
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