database - mysql - add columns to a table or create new table and join -
i have following setup:
a table n columns contain let's say... pizza details. there 4 kind of pizzas @ point until pizzas had same details, each detail saved in column.
but new kind of pizza called super pizza appeared, has 2 more types of details needs saved.
there 2 ways (that can think about):
add columns existing table, , leave them blank/null/whatever rest of 4 pizzas types
create new table 3 columns (idpizza, newdetail1 , newdetail2), save pizza rest of pizzas, , when data join 2 tables
first option has disadvantage keep useless data pizzas except new type (80% of table @ average pizzas distribution).
second option has disadvantage each time new kind of pizza need make join. db kind of "messy"... having part of pizza element stored in table , other part in another.
i know matter of taste how think should proceed? incline bit first option second opinion welcomed.
as note: there lots of entries in tables (like tens of thousands).
second note (based on answer): can't refactor "pizza" table, add it.
i suggested use first option. because 2nd option reserve more resources 1st option , take more time process.
as disadvantages of 1st option have mentioned quite obvious,but when need more column add new existing table.
Comments
Post a Comment