Before you start suggesting this question for duplicate read it, I have searched and i haven't found any proper solution.
So, i'm building a social networking site (I know that you are laughing right now) and i want to save the friendship states and the messages that users send everyday.
Now let me explain the problem more clearly, I thought that if i use a table for the friendships and have 40K users (and the average user have 50 friendships) that means that the table is going to grow to 2 million rows!
This will result to slow data processing or even to a database failure.
What if I use the file system to store the friendships instead of a Database?
I mean, i can store friendships in files.
(every user could have a "buddy.dat" file in his personal subdirectory that contains his friendships)
I have already done this thing for the messages, every user has a personal subdirectory created with a "messageges.dat" file that contains his conversations.
(This means that I'm going to have a directory with 40K personal sub-directories! 1 for every user)
Are there any consequences if I use the file system for this purpose?
(store the friendships/messages to files and then retrieve the data from there)
What is your opinion / solution?
I have news guys!!
I made a script to generate 40K directories in the "messages" directory and another script that generated 2 million rows in the users table!!
So, in the 40K directories case, they didn't slow down my site's scripts, it only took me half a minute to list them if i wanted with the file browser in a Debian distro.
In the mysql 2 million rows case, the 2 million rows didn't slow down my database or the site either, everything was ok.