Storing images in SQL Server?

2019-01-01 01:42发布

I have made a small demo site and on it I am storing images within a image column on the sql server. A few questions I have are...

  • Is this a bad idea?

  • Will it affect performance on my site when it grows?

The alternative would be to store the image on disc and only store the reference to the image in the database. This must be a common dilemma many people have had. I'd welcome some advice and would actually be happy to make a less of a mistake if I could.

7条回答
浪荡孟婆
2楼-- · 2019-01-01 02:25

Why it can be good to store pictures in the database an not in a catalog on the web server.

You have made an application with lots of pictures stored in a folder on the server, that the client has used for years.

Now they come to you. They server has been destroyed and they need to restore it on a new server. They have no access to the old server anymore. The only backup they have is the database backup.

You have of course the source and can simple deploy it to the new server, install SqlServer and restore the database. But now all the pictures are gone.

If you have saved the pictures in SqlServer everything will work as before.

Just my 2 cents.

查看更多
登录 后发表回答