Dear list,
I have two simplified tables "country" and "location":
create table country (
code char(2) primary key,
name varchar(60)
);
create table location (
id serial primary key,
country char(2) references country(code),
[...]
);
Location should have a foreign key to country.code, but for performance &
ressource reasons it would be much better to have a copy of the country
code in location.country rather than a foreign key:
create table location (
id serial primary key,
country char(2) check ...
);
What would the most efficient formulation of the "check" constraint be in
this case?
Horst