Application Development and Automation 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: 
Read only

primary keys & index

Former Member
0 Likes
1,011

i know the difference b/w pkey anf index but any tell me what happens internally while we are using index key word,can any explain with example?

more over how many primary keys & indexes can be created for a table.

i know the difference b/w pkey anf index but any tell me what happens internally while we are using index key word,can any explain with example?

more over how many primary keys & indexes can be created for a table.

6 REPLIES 6
Read only

Former Member
0 Likes
981

Hi Ajay,

Hearty Welcome to SDN.

Number of columns per table (with KEY) - 1024.

Number of columns per table (without KEY) - 1023.

Number of primary key columns per table - 512.

Number of columns in an index-16.

Number of indexes per table - 255

Please make sure you search in SDN before posting any thread since there will be many threads with almost same query.

First spend sometime in SDn site and get know how well you can use this site.

Cheers!!

Venkat

Edited by: Venkat Reddy on Oct 25, 2008 11:04 AM

Read only

Former Member
0 Likes
981

PK can a single Field or a combination of fields, that totally depends how any record in the table can be uniquely identified in the table.

By default, Primary Index is created on the Primary Key, but you can create a secondary indexes on other fields and I believe there is no limit on that.

Index of a table is like the Index of your book where the First page on any topic is stored and you can jump directly to that page only, without going through the pages/topics before your the topic that you are looking.

Just think for a 1000 page book without any index......everytime you have to go through each & every page to search until you don't get the topic of your interest.

Similary, the Table index stores the Memory address of the Key/Field on which it is created and hence when you mage your access to the table based on that Table key/field..Index helps the runtime enviroment to read the Record quickly.

Primary Index stores the memory address of all the records of the table along with the primary key value which uniquely identifies the record ....Similarly Secondary index stores the Memory address and the value of each record of the table.

Read only

0 Likes
981

yaa thanks for it ajay,

that's fine then why we go for secondary index for a table ,

and how many secondary index will be created for a table.

Read only

0 Likes
981

Hi Ajay,

As I mentioned there is no limit on the no of Secondary Indexes. You can create as many as you want.

There will be some tables with larger data which you will be accessing frequently based on a non key field like a Accounting Document Number Table and non key field can be Document Type, in such cases you create Secondary indexes so that system should start using that.

You can use Txn ST05 to check whether Secondary indexed is being used or not in a database fetch.

Secondary index if not used properly can be a overhead for the system and hence use with a precaution.

http://help.sap.com/saphelp_nwpi71/helpdata/en/cf/21eb2d446011d189700000e8322d00/content.htm

Read only

Read only

0 Likes
981

Hi Sagar,

we can create secondary indexes for a table in the ABAP Dictionary, ton the database. Secondary indexes can be unique or non-unique.

Check this link you can better understand for your query.

http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb47446011d189700000e8322d00/content.htm

Cheers!!

Venkat