php - social network - User profile design schema question -


i creating user profiles on site , lost on how design this: there many fields, 1:1 city of residence, birthday, etc. there on 50 fields 1:many (or many many?) favorite movies, sport teams, dating preference, screen names, phone numbers, email addresses etc. gets more complex when have previous companies worked at, previous schools, etc. person can belong many companies , there many fields in group date worked at, department, company name, industry name, etc.

so question how store this? if normalize these profile fields there many many tables join. far read, social networks people recommend denormalized approach. eitherways, storing user details , profile details in main user table, each row unique user. if have store these multiple preference, esp favorite movies can go in hundreds , past companies have whole group of fields, there lots of duplicates in user table.

what approach social networks take this?

social network data storage questions no different data storage questions in general... normalized , related data best way 'store' data efficiently. rdbms made handle these relationships - pk-fk relationships , joins main point of relational dbs... though 'see" join join join etc, db (should be) efficient in handling these joins.

from usage standpoint of getting pertinent data - make sure indexes accurate , optimized - , make use of views 'flatten' data need display purposes...

so whatever application server using data call view - 'appear' you, developer, 'flatter' representation of data, making ui , app serer interaction cleaner , more efficient (both in resources, , in coding),

as general guideline - flattening of data considered 'acceptable' in data warehousing environment... of course don't open monstrous debate of "just how normalized, 'normalized'" (first - sixth form of normalization...)

i guess think of sn more of olap, oltp. in case 'some' de-normalized data storage common - , acceptable - really, decide how de-normalized want things... instance - in examples, of employment history , movies, sports. i'd think simple 1:many allowing duplicate entries on such items fine, , easier maintain...

hope helpful,


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -