すべての製品を含むテーブルがあります。製品には 3 つの異なるタイプがあるため、これらには独自のテーブルがありますProductType1, ProductType2, ProductType3
。
Products
とProductType(n)
onの間には 1 対 1 の関係がありますがProductId
、子テーブルをさらに制約するために、 ProductId, ProductTypeId
inProducts
とin を使用した追加の関係がありProductId, ComputedProductTypeId
ます。
これにより、製品を単一の一致ProductType
テーブルにのみ追加できるようになります。
質問はこれです。ProductId
FK のインデックスを使用するのではなく、上の 2 つのテーブル間に既に関係があるため、一意のキーを使用して関係を制限できますか?それともパフォーマンスの問題が発生しますか?
製品
PK ProductId
FK ProductId, ProductTypeId
^
*Add an index for this or unique key constraint?*
製品タイプ(n)
PK ProductId
FK ProductID, ComputedProductTypeId (fixed int)