Reputation: 4014
A DB design question.
I need to design an item with multiple versions of the same value, like a shoping cart product in a multilingual store.
Say I have a product
CREATE TABLE product
id INT,
name VARCHAR(64),
description SMALLTEXT,
whatever BOOL,
another INT;
and a translation table
CREATE TABLE product_language
product_id INT,
language_id INT,
name VARCHAR(64),
descripton SMALLTEXT;
Now my question is... is table product
sensible or not? Most of the shops will be 1 language only, so does it make sense to keep name and description in default language in product
table to avoid JOINs
when there is only one language on the system? Or will it give me headaches I can not foresee?
Upvotes: 4
Views: 164
Reputation: 42497
I would say the JOIN to get the product_language would be inconsequential. RDBMs are really good at executing performant joins :). I don't see any benefit to using a "default" name and description. You'd have to synchronize the value and/or have special handling in your application to show the default name and description if no matching language-specific is available.
Upvotes: 4