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: 

Index on Primary Key

Former Member
0 Kudos

Hi Gurus..

I would like to know that is it advisable to create to index on Primary keys.

suppose i have 8-10 PK with the table so can i go for Index for 3-4 fields from that PF list ??

-Maharshi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

By default Primary index is created on Primary key fields.

However you can generate the secondary index on the primary key to make your search/Selection much faster.

Example:

Let your table contains 20 feilds like:f1,f2,...f20.

f1 to f10 are primary keys.

Then Primary index will be on f1 to f10.

Seconsry index can be created on f2,f5,f7.

Regards,

Rama.P

3 REPLIES 3

Sm1tje
Active Contributor
0 Kudos

It is possible, however I'm not sure if it is advisable. This depends on the fields you have in mind. There are some guidelines for this. Read the following link:

[What to Keep in Mind for Secondary Indexes|http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21eb2d446011d189700000e8322d00/content.htm]

Former Member
0 Kudos

Hi Maharshi,

I assume you ask if it is advisable to create a secondary index on parts of the columns which build the primary key. Plural is not correct for the primary key, because there is only one per table. But it could have multiple columns or fields.

If this was your question, then it is possible and sometimes advisable. There is even one table D010INC where the secondary key has the same columns like the primary key but with oposite order. Primary key is build of both columns master and include and secondary key is build of include and master. But as already mentioned it does not always make sense. When your fields are not very selective or your query, for which you want to create the index, is not often used but the table is heavily changed, then it could be not advisable.

The bottom line is, with that little information you supplied, it could be advisable or not dependent on your table, fields, data distribution and SQL statements.

Regards

Ralph

Former Member
0 Kudos

Hi,

By default Primary index is created on Primary key fields.

However you can generate the secondary index on the primary key to make your search/Selection much faster.

Example:

Let your table contains 20 feilds like:f1,f2,...f20.

f1 to f10 are primary keys.

Then Primary index will be on f1 to f10.

Seconsry index can be created on f2,f5,f7.

Regards,

Rama.P