PDA

View Full Version : mySQL: Most efficient tables?



StarXploser
September 16th, 2006, 11:13 AM
Hello,
I'm building a small app that lets people find users with the same interests.
I dont know exactly what I will put in there but I was thinking something like, Favorite Book, Movie, Actor,...,hobby,etc...

I would like to hear from you guys if you think that the way I'm building my mySql tables makes sense, I don't want to restructure everything after the site is launched. So here is what I have so far:

USERS
---------------------------------------------
| ID | Name | D.O.B | Etc.... |
---------------------------------------------

FavBOOKS
----------------------------
| BookTitlte | UserID |
----------------------------

FavActor
-----------------------------
| ActorName | UserID |
-----------------------------

ETC......
-------------
| ... | ... |
-------------


Does it make sense? Is there a better way?

Thanx

bwh2
September 16th, 2006, 11:45 AM
read through the facebook dissection thread (http://kirupa.com/forum/showthread.php?t=227583), in particular posts 2-4. basically i would set it up as shown below.

http://img238.imageshack.us/img238/1812/usersfavoritessystemerdxu9.th.gif (http://img238.imageshack.us/my.php?image=usersfavoritessystemerdxu9.gif)

and now that i think about it, a more efficient method of checking if an interest list has been changed may be to hash the string, test the hash, then if not while through the array of interests. hmm.

StarXploser
September 16th, 2006, 01:30 PM
Thanx a lot!
bwh2, your posts have always been very useful, I appreciate it.

bwh2
September 16th, 2006, 01:58 PM
no problem. let me know if you have any more questions.