Note that there are some explanatory texts on larger screens.

plurals
  1. POBest database design for storing profile pictures
    primarykey
    data
    text
    <p>I'm not very well traversed in database design so I've come to you guys for help. I have a table with records of users. The tablet looks like thing like this:</p> <pre><code>+----------+----------+----------+----------+----------+----------+----------+--------- | id | username | password | firstName| lastName | birthDate| pictures| ..... +----------+----------+----------+----------+----------+----------+----------+--------- | . | . | . | . | . | . | . | | . | . | . | . | . | . | . | ..... . . . . . . . </code></pre> <p>The pictures field indicates how many pictures a user has uploaded. <br /> I have written a feature that allows users to upload pictures to our servers. The file uploaded is named to something random. Users are only allowed 6 images. <br /> I am currently getting the location of the file and storing the locations in a table that looks like this:</p> <pre><code>+----------+----------+----------+----------+----------+----------+----------+--------- | id | username | default | pic1 | pic2 | pic3 | pic4 | ..... +----------+----------+----------+----------+----------+----------+----------+--------- | . | . | . | . | . | . | . | | . | . | . | . | . | . | . | ..... . . . . . . . </code></pre> <p>Assuming a user has more then 0 pictures, when a users profile is visited the 'default' field is called upon to get which column stores the address of the default picture. For example if 'default' is equal to 2, the data from column 'pic2' would be pulled and returned first, then the other non empty columns would return their respective data.</p> <p>My first question is: is this method of having multiple tables a bad idea? Is implementing a design where a picture has its own column a bad idea?<br /> As you guys can see this method is not scaleable in the least bit. What would be a good, <i> efficient</i>, scaleable design to implement this profile system? I am expecting to have 50,000 - 60,000 users.</p> <p><br />Also if possible recommend me a good book that will give me a crash course in database design! (crash course please nothing too long or detailed!)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload