Subject | Design Advice |
---|---|
Author | Luiz Alves |
Post date | 2002-01-10T22:36:38Z |
I have a table T1 that will contain many thousands records. As sample:
T1: id Integer
c2 Integer (It will get your values from 'nr' column in T2)
T1 will have many repeted values in c2.
I need T2 as: nr Integer
name varchar(30)
T2 will have no more than 20 records.
Should I create a foreign key constraint with 'on update cascade' and 'on
delete set null' in T1 as:
ALTER TABLE T1
ADD CONSTRAINT FK_XX
FOREIGN KEY ( c2 )
REFERENCES T2 ( nr )
ON UPDATE CASCADE
ON DELETE CASCADE
or for performance, I must to do it using triggers em T2 to update T1?
Thanks in Advance,
Luiz.
T1: id Integer
c2 Integer (It will get your values from 'nr' column in T2)
T1 will have many repeted values in c2.
I need T2 as: nr Integer
name varchar(30)
T2 will have no more than 20 records.
Should I create a foreign key constraint with 'on update cascade' and 'on
delete set null' in T1 as:
ALTER TABLE T1
ADD CONSTRAINT FK_XX
FOREIGN KEY ( c2 )
REFERENCES T2 ( nr )
ON UPDATE CASCADE
ON DELETE CASCADE
or for performance, I must to do it using triggers em T2 to update T1?
Thanks in Advance,
Luiz.