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: 

unique index

Former Member
0 Kudos

hi all,

i wanna know that what is the significance of unique index if primary index is already there?

thanks

shweta

7 REPLIES 7

former_member598013
Active Contributor
0 Kudos

Hi Shweta,

Welcome to SDN !!!.....

In SAP basically there are two types of indexes are there

Primary Index

Secondary Index.

Primary Index: This is basically bydefault key which is used to identify any instance of record.

But there are other cases where you need to identify the record on the basis of non key value in that case we use the Secondary index...

Thanks,

Chidanand

Former Member
0 Kudos

Hi Shweta,

An entry in an index can refer to several records that have the same values for the index fields. A unique index does not permit these multiple entries. The index fields of a unique index thus have key function, that is they already uniquely identify each record of the table.

The primary index of a table is always a unique index since the index fields form the key of the table, uniquely identifying each data record.

You can define a secondary index as a unique index when you create it. This ensures that there are no double records in the table fields contained in the index. An attempt to maintain an entry violating this condition in the table results in termination due to a database error.

If the index fields represent the primary keys of the table, that is, if they already uniquely identify each record of the table, the index is referred to as an unique index.

For more details go through the links.

http://help.sap.com/erp2005_ehp_03/helpdata/EN/9b/c743f5b40711d194f900a0c929b3c3/frameset.htm

http://help.sap.com/erp2005_ehp_03/helpdata/EN/c4/3a7187505211d189550000e829fbbd/frameset.htm

http://help.sap.com/erp2005_ehp_03/helpdata/EN/cc/7c58b369022e46b629bdd93d705c8c/frameset.htm

Former Member
0 Kudos

why do we create unique index if primary index is there because primary index is also uniquely identify a record in a table and doesnt permit duplicate records.so what is the significance of unique index ?

Edited by: shweta gupta on Oct 13, 2008 7:52 AM

0 Kudos

Swetha,

What do you mean by Unique index? Only Primary index is unique index for a table.

Secondary indices will allow duplicate entries.

What do you exactly want to know?

Cheers,

Kothand

Former Member
0 Kudos

hi,

indexes r used for fetching data from tables faster....

indexes r of two types :

=>primary

=>secondary

suppose a primary index has two fields and in ur select query u r using that primary index(by using those two fields in ur where clause of select statement),then the search in the tables w.r.t. select query will be faster as index comes into place...

if ur where clause in select statement doesn't corresponds to an index,one can create a secondary index,THIS WHERE THE QUESTION OF UNIQUE INDEX COMES

Edited by: siddharth kumar on Oct 13, 2008 7:59 AM

Former Member
0 Kudos

Hi Shweta,

Good question, the primary Index is also a unique index but can only contain the all key fields of the table where as you can define a unique index by using any combination of fields in the table (which is nothing but sec index)

Regards,

Hussain

siva123hana
Explorer
0 Kudos

Hello,

Whether unique Index on SID table will be created automatically or do we need to the run the program: RSDG_IOBJ_DUPLICATE_SID_CHECK ?

Thanks

Siva