Re: Use of Domain/Foreign Keys
Posted in 1997
I have found triggers to quite useful in cases like this. They can perform code validations against code tables without the expense of a foreign keys. Plus if new codes are added the check constraint does not have to be dropped an readded. This can be time consuming on large tables since every row must be rechecked. There are cases (at least in the data models I produce) that use a give domain in several tables, and I prefer to maintain the domain in one place (the code table) instead of several in the form of check constraints. Hope this helps. Robert Owens wrote: > Hi all, > > This is a simple question -- I think. > > I have a table with about 20 columns. Ten of the columns are 2 > character > codes that have associated tables with the valid codes and > descriptions. > There are 300,000 records in the first table and from 10 to 100 codes > in > each of the other tables. > > Should I set these up as domains? > > Foreign key from my table to the associated tables? > > How efficient is each solution? > > Later, > Bob O.