Reputation: 3333
My question may be quite similar to others, but not the same. In the information system that I'm developing, I faced the next problem: I need to store many image data (many ~ 100k per month and 1.2-1.5 million per year). I am thinking of two approaches: storing in DB as BLOB or storing in DB file path. From related questions I read that storing in DB only reference is cheaper for performance. Also no need to write handlers (in asp.net to get BLOB field from DB). But having over 1 million files - is it a good idea? It will be very hard to back up and when some files are accidentally deleted, the database is not consistent anymore. The approach to store all in DB does not have these problems. What would you recommend? Has someone faced this problem?
Upvotes: 1
Views: 2117
Reputation: 55122
You can attack this in many ways. first of all, storing images in databases is a bad idea.
Better ways to do it is to store in a distributed file system.
have a scalable naming schema, and store that location info in the database or distributed hashtable. That s how all the corps do it.
Upvotes: 0
Reputation: 473
I would go with database...If you have ever seen 1 million files in the same folder, it can be very difficult on the file system and tough to navigate
Upvotes: 0
Reputation: 62159
You miss one critical thing. Storing the files in the database WHICH STORES IT IN THE FILE SYSTEM, not in the MDF file. Look in the documentation for FileStream. Integrated backup, full access via SQL, but the files are on a separate share and / or even another computer.
Upvotes: 2
Reputation: 17
With that many files, backup is going to be a pain regardless. You're better off taking the cheaper approach for now.
Upvotes: 0