0

I'm working on a project which requires millions of images to be stored for their relative rows.

I have decided to store the images on the file system and store the image's path in a separate table which has a foreign key to the row which the images belong to.

Since I will be storing millions of images, I'm a bit concerned about keeping track of these images. I will have to add a few computers/hdds to store the images. From what I have read I should be using a distributed file system. Am I correct?

Are there any best conventions I should follow before I start implementing this? I'm thinking about storing the images and giving them a UUID name, and to store the UUID as the path of the image. Then my application ill contact the rest of the path.

  • Did my answer point you in the right direction? You still have a question on this? – Evan Carroll Dec 8 '17 at 21:49
1

I have decided to store the images on the file system and store the image's path in a separate table which has a foreign key to the row which the images belong to.

Why not just store the paths on the images table? Why have a 1:1 relationship?

Since I will be storing millions of images, I'm a bit concerned about keeping track of these images. I will have to add a few computers/hdds to store the images. From what I have read I should be using a distributed file system. Am I correct?

You likely do not need a distributed file system. I wouldn't bother with that. Just start an ZFS array up.

Are there any best conventions I should follow before I start implementing this? I'm thinking about storing the images and giving them a UUID name, and to store the UUID as the path of the image. Then my application ill contact the rest of the path.

I wouldn't do that. You're only talking millions. Just use an int. If you want to store something useful on the row, I would store the sha256 of the image.

  • I want to add weight to the "Why not just store the paths on the images table?" The location is an attribute of the image. Even if you were to decide to move a bunch of images to a new location updating 1 by 1 is valid (or as a batch whichever way you go). Separating out to another table seems like unnecessary overhead. – Kent Chenery Dec 8 '17 at 8:47
  • the reason I want to have a separate table is because I will be storing ads, and each ad will contain X amount of images. Isn't the correct way of doing this? – Arya Dec 9 '17 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.