database design - Except joining 20 tables any other options for writting / reading data? -


i creating user profile. fields lookup based own tables favourite movies, favourite music, favourite food, sports, etc... these not text fields auto suggest fields system maintained list. reason these in own table have more colunms unique them.

so read data @ user input ok after 2 problems:
1) writting data: since m:m relationship need 20 different tables?
2) reading data @ profile load time: need join these 20 tables user's data?

what other option have store these user details? concern performance since social site. 20 joins not good. not sure other techniques. using mysql , php.

the other option can think of store data in array in db although dont know how searches work that.

  1. install favorite dbms.
  2. create user table, , 2 or 3 user favorites tables.
  3. write little program generate , load million random users.
  4. write little program generate , load 10 million favorite movies (or whatever) million users.
  5. run queries.

if speed problem, post schema "database-design" , "query-optimization" tags, , include link question.


later . . . bored. did test myself. don't have time 20 joins, 5 left joins, on table of million users , 50+ million rows in each of joined tables returns in 400 milliseconds. (postgresql 9.0.2) work . . .


and still later . . . still bored. added more tables, more data, more left outer joins. depending on data particular email address, more joins can still faster. (would have guessed that?) last test ran, selecting few dozen random email addresses "users",

           run time (milliseconds) -- median      40  maximum    222 minimum      0.4 ("four tenths of millisecond", not typo.) 

if i'm still bored later, i'll bang program

  • execute few hundred queries based on random email addresses, and
  • record execution time (although i'm not sure that's possible)

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -