在SQL Server 2008数据库中存储大量文件有哪些不同的可能性? [英] What are the different possibilities to store a large number of files in a SQL Server 2008 Database?

查看:127
本文介绍了在SQL Server 2008数据库中存储大量文件有哪些不同的可能性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我要建立一个网站,其中将包含大量(至少1000万个)小文件(大约50KB,主要是PDF,还包括word/excel文档,jpg和文本文件).

Let's say i want to build a website that will hold a very large number (at least 10 millions) of small files (around 50KB, mostly PDF, but also word/excel documents, jpg, and text files).

使用SQL Server 2008数据库,存储这些文件有哪些不同的技术可能性(例如:使用带有用于文件名的表+用于数据的文件系统,使用varbinary等)?

Using SQL Server 2008 database, what are the different technical possibilities to store these files (eg: using a table with for filenames + filesystem for data, using varbinary, etc...) ?

推荐答案

SQL Server 2008数据库提供程序提供了许多数据类型来存储二进制数据.

SQL Server 2008 database provider many datatypes to store binary data.

FILESTREAM数据类型是SQL Server 2008中引入的,它们提供了将二进制数据存储到数据库的功能.但是,由于二进制数据量很少,因此使用文件流效率不高,因为它需要额外的开销,例如在SQL Server 2008中进行文件创建和处理.FILESTREAM存储不适合您的情况 我认为

FILESTREAM datatype was introduced in SQL Server 2008, They offer the capability to store binary data to the database. But With a small amount of binary data, it's not efficient to use a file stream, Because it needs extra overhead like file creation and handling In SQL Server 2008. FILESTREAM storage is not right for your situation In my opinion its best for

  • 平均1MB或更高.
  • 不需要加密时,因为FILESTREAM数据不支持

另一方面,varbinary数据类型适合您的情况,它的优点是节省存储空间并保持数据的准确表示.

On the other hand varbinary datatype is mpore suitable in your case, The advantages is saving storage space and keeping an accurate representation of the data.

通常,FILESTREAM适用于较大的文件,而VARBINARY适用于较小的文件.

In general FILESTREAM is good for larger files and VARBINARY for smaller ones.

也可以将文件直接存储到数据库中,因为它们的大小确实很小.

Also It will be good to store files directly into database as they are really less in size.

在这里您可以了解更多有关它的信息-数据库:图片文件是Blob还是文件路径?

here you can read more about it - Database: image file as blob or file path?

希望这会有所帮助

这篇关于在SQL Server 2008数据库中存储大量文件有哪些不同的可能性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆