Database: image file as blob or file path?

后端 未结 3 640
北荒
北荒 2021-01-20 23:54

I know this question has been asked any a times.

I read this whole post but still couldn\'t reach to a point.

I am making a website which will allow users to do

3条回答
  •  梦谈多话
    2021-01-21 00:27

    In My opinion you should store path in instead of blob. But again it depends upon many other things - Do you have your own server? or you are hosting it on somewhere else ? Are these things really critical to put as blob in DB ? What will be your backup strategy etc..

    I have my own reasoning

    • File system is there to manage files and in your case songs and images are not very critical. and imagine if your database will grow in size the performance will go down. If objects are larger than one megabyte on average, NTFS has a clear advantage over SQL Server

    Also keep in mind when you have to take backup of your database it may be a big headache at some stage. On the other hand if your songs file are on disk then it will be easy.

    Also if you are storing just the path in database, you can consider to keep your songs and picture on some other server (or multiple servers) as well.

    In short, I can see many advantages to use file system to store songs and pictures.

提交回复
热议问题