Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you think it's a good idea to save billions of images into Database?

Tags:

database

Recently, I and my colleagues, we are discussing how to build a huge storage systems which could store billions a pictures which could searched and download quickly.

Something like a fickr, but not for an online gallery. Which means, most of these picture will never be download.

My colleages suggest that we should save all these files in database directly. I really feels that it's not a good idea and I think database is not desgined for restore huge number of binary files. But I have very strong reason for why that's not a good ideas.

What do you think about it.

like image 851
ablmf Avatar asked Jul 31 '09 14:07

ablmf


3 Answers

When dealing with binary objects, follow a document centric approach for architecture, and not store documents like pdf's and images in the database, you will eventually have to refactor it out when you start seeing all kinds of performance issues with your database. Just store the file on the file system and have the path inside a table of your databse. There is also a physical limitation on the size of the data type that you will use to serialize and save it in the database. Just store it on the file system and access it.

like image 125
Srikar Doddi Avatar answered Oct 18 '22 06:10

Srikar Doddi


If you are really talking about billions of images, I would store them in the file system because retrieval will be faster than serializing and de-seralizing the images

like image 23
andrewWinn Avatar answered Oct 18 '22 06:10

andrewWinn


The answers above appear to assume the database is an RDBMS. If your database is a document-oriented database with support for binary documents of the size you expect, then it may be perfectly wise to store them in the database.

like image 22
Eric Bloch Avatar answered Oct 18 '22 04:10

Eric Bloch