2

I have to manage some files in a web application, let's say the avatar images of user profiles. I asked myself: should I use a blob field in user's database table or simply in a filesystem file like avatars/{userid}.jpg? What are advantages to store blob into database if I do not need search capabilities in this field?

2 Answers 2

2

One thing to consider is also the number of files. If you have to manage a large amount of files (>10.000 at least) you have to think of organizing the files in a directory - structure, otherwise some filesystems may get slow. The DB usually takes care of that.

Also, if a user already has a connection to a database, you do not need to worry to setup a shared file to which all the users can connect. On the other hand, single file security management is a little harder in the database, sind you have to do it yourself.

Sign up to request clarification or add additional context in comments.

Comments

1

There are few advantages if you are not already running a database. If you are, you can take advantage of the caching features of that database, in some situations. For the most part, though, if you don't need to search, use the filesystem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.