‎2007 May 01 9:37 AM
‎2007 May 01 9:42 AM
‎2007 May 01 9:38 AM
Hi pinky,
1. SECONDARY INDEX.
They are generally used for faster access.
EG.
In a table there are 10 fields.
1,2 are primary fields (primary index)
2. But the table is queried many times
on field number 6 (eg).
So we can create a NEW Index
(Secondary index)
only on that 6th field.
3. Due to this,
the sql will become faster
because NOW
the database will search on the
basis of secnodary index (made on 6th field)
regards,
amit m.
‎2007 May 01 9:40 AM
Hi!
Documentation
If you need to access an internal table with different keys
repeatedly, keep your own secondary indices.
With a secondary index, you can replace a linear search with a
binary search plus an index access.
Entries: 1000, Line width: 100
Key width: 20
The READ locates the 500th entry.
READ TABLE ITAB INTO WA
WITH KEY DATE = SY-DATUM.
IF SY-SUBRC = 0.
" ...
ENDIF.
Entries: 1000, Line width: 100
Key width: 20
The READ locates the 500th entry.
READ TABLE SEC_IDX INTO SEC_IDX_WA
WITH KEY DATE = SY-DATUM
BINARY SEARCH.
IF SY-SUBRC = 0.
READ TABLE ITAB INTO WA
INDEX SEC_IDX_WA-INDX.
" ...
ENDIF.
Read with Binary search improves the performance.
Consider the following example.
In linear search If you are searching for a number 99 in a set of 100 numbers, you would hit the number 99 in the 99th time.
If you do it the binary way, you can get it in much lesser passes.
split the 100 numbers into two parts.
less than 50 and greater than 50.
If your number (99) is not there in the first part, you don;t need to search that set of 50 numbers at all.
Now, you have to search for only the second set of 50 numbers that is 51-100 only.
Again split the fifty numbers into two.
51-75 anf 76-100.
99 doesn't lie in 51-75.
It should be there in 76-100 only..so discard the 51-75 set.
Continue this process until you find the number.
Which would be less than 10 chances compared to 99 chances in linear search.
Regards
Tamá
‎2007 May 01 9:42 AM
‎2007 May 01 9:43 AM
Hi ..
U can see this useful link for wholesome info :
<b>http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb20446011d189700000e8322d00/content.htm</b>