php - MySQL use JOIN or store directly -
i have tables users , posts. table users have columns user_id , username, , table posts have columns post_id , user_id.
when i'm getting posts want username, better use join between tables users , posts username, or store username in table posts?
how join affects on performance, assuming have more few million rows in posts , users tables?
the accepted practice utilize join statement , not have username within posts table. violate normal form , result in redundant data. - happens if username changes? have 2 tables (users, posts) no longer match because there records user_id not match username. things consider.
Comments
Post a Comment