I think this is related to my previous question about creating foreign
key.  If the referenced column is the primary key, does that mean sapdb
does a table scan every time it does referential-constraint-check when
it creates foreign key?

Thanks,
> 
> 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
-- 
Jenny Zhang
Open Source Development Lab Inc 
15275 SW Koll Parkway - Suite H
Beaverton, OR 97006
(503)626-2455 ext 31

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to