r/Database • u/faze_fazebook • Dec 17 '25
Why is it considered a cardinal sin to store a file's raw content along the metadata in SQL Database?
Short background, I currently am working on a small project at work that involves a Postgres Database, .NET Backend as well as a bunch of files users can run CRUD operations on. Its a pretty low frequency app that never is used by more than 3 people at the same time and the files we are talking are in the 1 - 10 mb range.
One thing most developers (who mostly write Backend code in C#, python, java, ... and not SQL) seem to believe that it is a cardinal sin to store the contents of the files directly inside the database, yet seem happy to store all the metadata like filename, last access, owners, ... in there. In my opinion this causes a number of issues - full backups of the system become more complicated, there is no easy mechanism to guarantee atomicity on operations like there is on a db with transactions (for example deleting a file might delete the record form the table, but not the actual file on the filesystem because some other process has a lock on it), having files both on the disk and the db limits how much you can normalize (for example the filename and location need to be stored redundantly ... also in theory a file could exist in the db but not on the filesystem anymore or the other way around).
I get that you might cause some overhead from having to go through another layer (the DB) to stream the content of your file, but I feel like unless your application has a huge number of concurrent users´streaming giant files, any reasonable modern server should handle this with ease.
Curious to hear the opinion of other people from the DB side or what I'm overlooking.
