I have a table having columns ProductTypeID, BrandID, SupportedBatteryID
, which stores batteryID
s supported by a particular product.
我有一个包含ProductTypeID,BrandID,SupportedBatteryID列的表,它存储特定产品支持的batteryID。
Non of the columns here are unique, So do i need a primary key on these kind of tables?
这里的非列是唯一的,所以我需要这些表上的主键吗?
If i will add a primary key will it increase the performance while searching batteries for a particular product by using product id?
如果我要添加主键,它会在使用产品ID搜索特定产品的电池时提高性能吗?
1 个解决方案
#1
1
You can build a clustered index on (ProductId, SupportedBatteryId
). This will help you without creating a Primary key
您可以在(ProductId,SupportedBatteryId)上构建聚簇索引。这将帮助您而无需创建主键
#1
1
You can build a clustered index on (ProductId, SupportedBatteryId
). This will help you without creating a Primary key
您可以在(ProductId,SupportedBatteryId)上构建聚簇索引。这将帮助您而无需创建主键