Can anyone please tell me the disadvantages of storing images in a MySQL database?
Is it not as efficient as storing the images on the server? Will it take longer for the images to download vs disk storage and will it put heavy load on the database? Appreciate the help!
谁能告诉我在MySQL数据库中存储图像的缺点吗?它不像在服务器上存储图像那样有效吗?与磁盘存储相比,图片下载需要更长的时间,是否会给数据库带来沉重的负载?感谢帮助!
2 个解决方案
#1
2
One advantage you get from storing images on the disk is that you can serve them directly with a fast web server (nginx), which doesn't have to hit your code at all. Another one is that you can easier switch to a CDN later if you have to.
在磁盘上存储映像的一个好处是,您可以直接使用快速web服务器(nginx)为它们提供服务,这根本不需要对您的代码进行攻击。另一种方法是,如果有必要,您可以稍后更容易地切换到CDN。
#2
2
Of course it might be a little slower than if you save them as files. Always depends how big and how many images you have.
We store the profile images in the DB and that works fine. It also makes the handling easier, because you don't have to worry about the file system and if you backup the DB, everything is backuped (is that a word?).
当然,这可能比将它们保存为文件要慢一些。总是取决于你有多大和有多少图像。我们将概要文件存储在DB中,这很好。它还使处理变得更容易,因为您不必担心文件系统,而且如果您备份了DB,那么所有内容都是备份的(这是一个词吗?)
Assuming you are not facebook or flickr I would not worry about it.
假设你不是facebook或flickr,我不会担心。
#1
2
One advantage you get from storing images on the disk is that you can serve them directly with a fast web server (nginx), which doesn't have to hit your code at all. Another one is that you can easier switch to a CDN later if you have to.
在磁盘上存储映像的一个好处是,您可以直接使用快速web服务器(nginx)为它们提供服务,这根本不需要对您的代码进行攻击。另一种方法是,如果有必要,您可以稍后更容易地切换到CDN。
#2
2
Of course it might be a little slower than if you save them as files. Always depends how big and how many images you have.
We store the profile images in the DB and that works fine. It also makes the handling easier, because you don't have to worry about the file system and if you backup the DB, everything is backuped (is that a word?).
当然,这可能比将它们保存为文件要慢一些。总是取决于你有多大和有多少图像。我们将概要文件存储在DB中,这很好。它还使处理变得更容易,因为您不必担心文件系统,而且如果您备份了DB,那么所有内容都是备份的(这是一个词吗?)
Assuming you are not facebook or flickr I would not worry about it.
假设你不是facebook或flickr,我不会担心。