A question:
I have 2 tables:
Product
id INT
name VARCHAR(64)
something TEXT
else INT
entirely BOOL
and
Ingredient
id INT
name VARCHAR(64)
description TEXT
Now I also have a link table
Products_Ingredients
product_id INT
ingredient_id INT
for my many to many relation.
Now both products and ingredients will have unique names. So I can use names as natural keys... however will that be a good idea?
Say I have a product: Paint Thinner Supreme
with ingredient: Butylonitrotetrocycline
Will that be a good idea to use those names as composite key in the link table?
As much as I understand idea behind using natural keys over the surrogates, I kinda can't stop thinking that using simple integers as primary keys (and foreign ones) will be much faster. Will there be a difference in a way in which MySQL server digests those different keys?
What is your opinion?
See Question&Answers more detail:os