Arne Gehlhaar > > Hi, > > is it useful or neccessary to create an index on the primary > and foreign > key columns? I am trying to migrate from Sybase ASE 11.0.3.3 to SAPDB > 7.3 and the Power Designer (DataArchitect) creates these indexes by > default. I remember reading that SAP DB automatically uses or creates > indexes for key columns, but I'm not so sure any more. > > Thanks, > Arne
Hi, PRIMARY KEY columns are not indexed in a normal sense. The whole primary table is stored according to the primary key sequence. If we are talking about referential constraints: the referenced column(s) given behind REFERENCES have to be the PRIMARY KEY of the referenced table or they have to be a complete unique index of that table. The referencing column(s) (the column(s) from the table for which you write the current create or alter-statement) need not be the primary key or an unique index. For performance reasons (for a delete in the referenced table) it is a good idea to have an index for them (need not be unique), otherwise the delete has to use table scan during referential-constraint-check (RESTRICT) or -handling (SET NULL, SET DELETE, CASCADE). Elke SAP Labs Berlin _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
