Dmytro
Dmytro

Reputation: 717

Best way to store files

What is the standard way to store uploaded files on server? In database as binary or on hard disk with path stored in database?

Upvotes: 8

Views: 10705

Answers (1)

Laurence
Laurence

Reputation: 1875

Microsoft did a research in this topic: https://www.microsoft.com/en-us/research/publication/to-blob-or-not-to-blob-large-object-storage-in-a-database-or-a-filesystem/

Storing very small files will get you the best performance in the database. Storing larger files give you the best performance on your hard drive. I researched this for a company where I work for. The file system performance will be better than the database when the file size is 512 kB or larger. The performance of the database will drop rapidly after this point.

Storing files in the database will give you the advantage that you can keep everything in sync. You can configure that a file BLOB will be removed when the file record is removed. However, storing large files will give you very bad performance and creating backups could take very long.

Upvotes: 19

Related Questions