I am designing an Entity Relationship Diagram (ERD) for a database that includes a table with variants annotated by different tools. In this table, each variant is annotated by a specific tool, and the combination of the tool and the variant uniquely identifies each row.
The table currently has two columns: database_tool and variantID. I am considering two approaches to define the primary key for this table:
Composite Key Approach: Using both database_tool and variantID as a composite primary key.
Single-Column Key Approach: Creating a new column, say database_tool_variantID, and using it as a single-column primary key.
I am seeking advice on which approach might be more beneficial for my database design. Are there specific advantages or potential pitfalls that I should be aware of with either approach, particularly in terms of query efficiency, database maintenance, and scalability?
Any insights or experiences with similar scenarios would be greatly appreciated.
tool_id
which refers onid
intools
table, andvariant_id
which refers onid
invariants
table? If so then PK(tool_id, variant_id)
+ regular(variant_id, tool_id)
seems to be reasonable. But this depends on DBMS - for example, in MySQL the primary key is clustered one unconditionally, so backward variant or even synthetic PK + unique (one of above) + regular (naother one) may be more reasonable.