Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Dear All,

I am developing an application that will deal with multiple images for a single profile, for that I have two option to store image in SQL:

a) I can convert image into byte array and store it in SQL as image data type, and
b) I can change the image name whenever it is being uploaded and save it in any location and store that location's path in database

Now I am getting confuse that which approach is better, either first one or else second one even I am able to implement both.

Please let me know the advantage and disadvantage of both this will be a great help.

Thanks a lot in advance.

Best Regards
Tanveer
Posted

My two cents -

If it you have a small set of images (profile records), go for the store in local drive approach.
If you have a large set of images (profile records), go for the database.
 
Share this answer
 
Comments
Khan Tanveer Alam 13-May-11 6:22am    
Hey Abhinav,

Thanks a lot for your quick response, it is really appreciated but if possible can you explain me technically who is better and why since i am going to work with a large set of images.
Abhinav S 13-May-11 6:27am    
If you are talking about maintaining 1000's of profiles with pictures, then it might be useful to go for the database approach.
Khan Tanveer Alam 13-May-11 6:34am    
There will be more than 10 thousands profile with multiple images for each profile. I do agree with you solution but still getting confused.

since in second solution they advocate second approach that is store in file system.
Sergey Alexandrovich Kryukov 13-May-11 6:23am    
Agree, my 5.
--SA
Abhinav S 13-May-11 6:25am    
Thank you SA.
Well I think most will agree with your second approach. Basically, the retrieval are pretty much faster than if it were saved to database. Just imagine the conversion that you need to do when you upload a 3MB file, and then retrieve it later on, as compared to just storing it in a file server, with your path in the database. Obviously, there are more processing done on the first one.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 13-May-11 6:25am    
Good, but -- my 4 as I rather agree with Abhinav. Extremely big number of files will cause a problem.
--SA
Khan Tanveer Alam 13-May-11 6:31am    
I think both the solutions have some distinct advantage and disadvantage, so i am requesting more and more people should share their views with a technical reason so that we can get a conclusion.

Nick Reshetinsky 13-May-11 8:00am    
yes...but many social networks like VKONTAKTE.RU ( more thean 40 millions members) save profile images as files on hard drives... they spread content among a bunch of servers.. I know it's really tough for a server to contain such amount of fils but the web request would be processed faster when a whole and ready file is waiting for a client "rather than collecting file BLOB in
little chunks of 8 KB from data pages like a puzzle for each request"
Kim Togo 14-May-11 3:49am    
Good answer. 5 from her.
If you look at flickr.com that dealing with many pictures, then I think they save all image on file system and a database for reference to locations.
 
Share this answer
 
Comments
Khan Tanveer Alam 14-May-11 0:13am    
Thanks a lot for your valuable suggestion.
Kim Togo 14-May-11 3:48am    
You are welcome. Good luck :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900