Re: Preventing Indexes on Foreign Keys
Posted in 1998
Topics: Triggers, Constraints & Referential Integrity
"Peter Tashkoff" <TashkoP@kiwi.co.nz> offerred: :Has anyone mentioned using check constraints. Personally I don't have any = :problems with FKs creating indexes, but if people are concerned about the = :oltp hit of maintaining them, and if there lookup values are essentially = :stable, then I would have thought that specifying a domain with the check = :statement would be the answer. A couple problems with this: first, a check constraint would have to be a hard-coded list. If you needed a new value to be "valid", you would have to drop the constraint and re-add it with the additional value. Second, and more important, a foreign key reference requires that the key value in one table be not only constrained but also that the value exist in the referenced table. A check constraint would not necessarily guarantee that a value existed in the other table (for example, someone could delete the row from the referenced table). The point of PK/FK is that it establishes an enforced relationship between tables that cannot be broken. Dave ********** "Everybody plays the fool, sometimes."