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: 

use of secondary index

Former Member
0 Kudos

what is use of secondary index. whether v can create it?

if so how to create it.

5 REPLIES 5

Former Member
0 Kudos

Indexes are used to enhance the speed of table search.actually primary indexes are automatically created on primary key fields...we can create secondary indexes for non key fields.

If we want to search some records vai non key fields..then to increase the speed of the table we create secondary index for that field in SE11.Then performance wise it improves...

Reward if useful.

Dara.

Former Member
0 Kudos

Hi ,

You can search a table for data records that satisfy certain search criteria faster using an index.

An index can be considered a copy of a database table that has been reduced to certain fields. This copy is always in sorted form. Sorting provides faster access to the data records of the table, for example using a binary search. The index also contains a pointer to the corresponding record of the actual table so that the fields not contained in the index can also be read.

The primary index is distinguished from the secondary indexes of a table. The primary index contains the key fields of the table and a pointer to the non-key fields of the table. The primary index is created automatically when the table is created in the database.

You can also create further indexes on a table in the ABAP Dictionary. These are called secondary indexes. This is necessary if the table is frequently accessed in a way that does not take advantage of the sorting of the primary index for the access. Different indexes on the same table are distinguished with a three-place index identifier.

The optimizer of the database system decides whether an index should be used for a concrete table access This means that an index might only result in a gain in performance for certain database systems. You can therefore define the database systems on which an index should be created when you define the index in the ABAP Dictionary

Creating Secondary Indexes

Procedure

In the maintenance screen of the table, choose Indexes.

If indexes already exist on the table, a list of these indexes is displayed. Choose .

In the next dialog box, enter the index ID and choose

The maintenance screen for indexes appears.

Enter an explanatory text in the field Short text.

You can then use the short text to find the index at a later time, for example with the R/3 Repository Information System.

Select the table fields to be included in the index using the input help for the Field name column.

The order of the fields in the index is very important. See What to Keep in Mind for Secondary Indexes.

If the values in the index fields already uniquely identify each record of the table, select Unique index.

A unique index is always created in the database at activation because it also has a functional meaning (prevents double entries of the index fields).

If it is not a unique index, leave Non-unique index selected.

In this case you can use the radio buttons to define whether the index should be created for all database systems, for selected database systems or not at all in the database.

Select for selected database systems if the index should only be created for selected database systems.

Click on the arrow behind the radio buttons. A dialog box appears in which you can define up to 4 database systems with the input help. Select Selection list if the index should only be created on the given database systems. Select Exclusion list if the index should not be created on the given database systems. Choose .

Choose .

Result

The secondary index is automatically created in the database during activation if the corresponding table was already created there and index creation was not excluded for the database system.

You can find information about the activation flow in the activation log, which you can call with Utilities ® Activation log. If errors occurred when activating the index, the activation log is automatically displayed.

Hope its useful.Reward points if useful.

Thanks ,

Surya Pydikondala .

Former Member
0 Kudos

Secondary index is a combination of fields that is different from the primary keys of database table.

If the requirement in your WHERE condition is to use combination of fields that is not the same as the primary keys of the table, it's advisable the create a secondary index especially if your SELECT statement takes a lot of time to retrieve records.

In DATA dictionary (SE11), click 'Indexes' at the upper part of your GUI to create secondary index.

Be sure that the order of fields in your secondary index is the same as created in the data dictionary. Another one, always make sure that the arrangement of the fields in your WHERE condition is the identical to the sequence of fields in your secondary index for it to function.

Hope this will help.

Former Member
0 Kudos

Hi,

Primary indexes are automatically created with key fields, In order to increase the performance of table access , we can create secondary indexes on non key fields. so that , we can decrease the access time from the table.

Up to 9 no of sec indexes we can create.

Reward if helpful

Rgds

Umakanh

prasanth_kasturi
Active Contributor
0 Kudos

hi,

secondary index helps when ur selecting the fields into the internal table based on non key fields at that time when you have secondary index selection process will be faster

yes we can create it.

goto se11---> give the table name and press change.

goto---> indexes

press create in the pop up

then you can crate the secondary index

upto 9 indexs u can create

REWARD IF HELPFUL

regards

prasanth