Storing Photos in a Database vs Storing Photos in a File System

One of the more common questions in terms of photo storage for web-based applications is whether to store photos in a database or in a folder on the website. Most discussions on this topic focuses on pros/cons in terms of ease of photo access, data integrity, and backups/recoverability.

In most discussions, it is not that clear cut. There are definitely pros and cons to each, and it is sometimes difficult to determine which method will work best in the long run. However, there is one additional factor that is seldom discussed, and is probably more applicable in a hosted environment, and that factor is hard drive space. Typically, in a hosted environment, your website will have much more space than the space allotted to you on your hosted database server. In that case, you are probably better off placing your photos in a folder, on your website, and access it that way. Otherwise, you run the risk of running out of precious database space.

If space is not an issue, I prefer storing my photos in the database for ease of backups/recovery, and data integrity. However, in a hosted environment where SQL space is limited, I would definitely lean towards storing it on the website.

No comments:

Post a Comment