This might be a silly question. I know two fields can be used to create a primary key. I'm wondering if it ever makes sense (has advantages) to instead create a new additional field from those two field's values and make that the primary key. My goal for this key is to make sure no duplicate records are allowed in the table (the combination of these fields are never really queried). The two original fields would remain.
A real example, I have a table of invoicing detail, the combination of the invoice_num and line_num fields are unique. The table has approx 35M rows. Should I just create a primary key using those two fields OR create a new field that is the concatenation of the two fields and make that the primary key (this concatenation would happen prior to the data being loaded into the table).
UPDATE: It appears what I'm referring to is a "surrogate key". https://towardsdatascience.com/the-difference-between-surrogate-and-primary-keys-222cf31ddb57 Surrogate keys are the ideal solution when you don’t have a primary key in your table but need a unique identifier. They are great for performance and detecting changes in historical records.
UPDATE: My question asked in a better way previously Should I create a surrogate key instead of a composite key?
thanks