SQL DBMS 上下文中的 BLOB 到底是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5414551/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is it exactly a BLOB in a DBMS context
提问by cMinor
- What is it a BLOB?
- How can I use it?
- What are the differences between DBMS's BLOBs. I would like to save data using BLOBs into any DBMS and then read that BLOB with a library.
- 什么是BLOB?
- 我怎样才能使用它?
- DBMS 的 BLOB 之间有什么区别。我想使用 BLOB 将数据保存到任何 DBMS 中,然后使用库读取该 BLOB。
回答by sgokhales
BLOB :
斑点:
BLOB
(Binary Large Object) is a large object data type in the database system. BLOB
could store a large chunk of data, document types and even media files like audio or video files. BLOB
fields allocate space only whenever the content in the field is utilized. BLOB
allocates spaces in Giga Bytes.
BLOB
(二进制大对象)是数据库系统中的一种大对象数据类型。BLOB
可以存储大量数据、文档类型甚至媒体文件,如音频或视频文件。BLOB
字段仅在字段中的内容被利用时才分配空间。BLOB
以千兆字节为单位分配空间。
USAGE OF BLOB :
BLOB 的用法:
You can write a binary large object (BLOB
) to a database as either binary or character data, depending on the type of field at your data source. To write a BLOB
value to your database, issue the appropriate INSERT or UPDATE
statement and pass the BLOB
value as an input parameter. If your BLOB
is stored as text, such as a SQL Server text field, you can pass the BLOB
as a string parameter. If the BLOB
is stored in binary format, such as a SQL Server image field, you can pass an array of type byte as a binary parameter.
您可以将二进制大对象 ( BLOB
) 作为二进制或字符数据写入数据库,具体取决于数据源中的字段类型。要将BLOB
值写入数据库,请发出适当的INSERT or UPDATE
语句并将BLOB
值作为输入参数传递。如果您BLOB
以文本形式存储,例如 SQL Server 文本字段,则可以将其BLOB
作为字符串参数传递。如果BLOB
以二进制格式存储,例如 SQL Server 图像字段,则可以将字节类型的数组作为二进制参数传递。
A useful link : Storing documents as BLOB in Database - Any disadvantages ?
一个有用的链接:将文档作为 BLOB 存储在数据库中 - 有什么缺点吗?
回答by Rondo
I won't expand the acronym yet again... but I will add some nuance to the other definition: you can store any data in a blob regardless of other byte interpretations they may have. Text can be stored in a blob, but you would be better off with a CLOB if you have that option.
我不会再次扩展首字母缩略词......但我会为另一个定义添加一些细微差别:您可以将任何数据存储在 blob 中,而不管它们可能具有的其他字节解释。文本可以存储在 blob 中,但如果您有这种选择,最好使用 CLOB。
There should be no differences between BLOBS across databases in the sense that after you have saved and retrieved the data it is unchanged.... how each database achieves that is a blackbox and thankfully almost without exception irrelevant. The manner of interacting with BLOBS, however can be very different since there are no specifications in SQL standards (or standards in the specifications?) for it. Usually you will have to invoke procedures/functions to save retrieve them, and limiting any query based on the contents of a BLOB is nearly impossible if not prohibited.
从某种意义上说,跨数据库的 BLOBS 之间应该没有区别,在您保存和检索数据后,它不会发生变化……每个数据库如何实现这是一个黑匣子,幸好几乎毫无例外地无关紧要。然而,与 BLOBS 交互的方式可能会有很大不同,因为 SQL 标准中没有规范(或规范中的标准?)。通常,您将不得不调用过程/函数来保存检索它们,如果不禁止,则几乎不可能根据 BLOB 的内容限制任何查询。
Among the other stuff enumerated as binary data, you can also store binary representations of text -> character codes with a given encoding... without actually knowing or specifying the encoding used.
在枚举为二进制数据的其他内容中,您还可以存储文本的二进制表示 -> 具有给定编码的字符代码......而无需实际知道或指定所使用的编码。
BLOBS are the lowest common denominators of storage formats.
BLOBS 是存储格式的最低公分母。
回答by Gary Myers
This may seem like a silly question, but what do you actually want to use a RDBMS for ?
这似乎是一个愚蠢的问题,但是您实际上想将 RDBMS 用于什么?
If you just want to store files, then the operating system's filesystem is generally adequate. An RDBMS is generally used for structured data and (except for embedded ones like SQLite) handling concurrent manipulation of that data (locking etc). Other useful features are security (handling access to the data) and backup/recovery. In the latter, the primary advantage over a regular filesystem backup is being able to recover to a point in time between backups by applying some form of log files.
如果你只是想存储文件,那么操作系统的文件系统一般就足够了。RDBMS 通常用于结构化数据和(除了像 SQLite 这样的嵌入式数据)处理该数据的并发操作(锁定等)。其他有用的功能是安全性(处理对数据的访问)和备份/恢复。在后者中,与常规文件系统备份相比的主要优势是能够通过应用某种形式的日志文件恢复到备份之间的时间点。
BLOBs are, as far as the database concerned, unstructured and opaque. Oracle does have some specific ORDSYS types for multi-media objects (eg images) that also have a bunch of metadata attached, and have associated methods (eg rescaling or recolouring an image).
就数据库而言,BLOB 是非结构化和不透明的。Oracle 确实为多媒体对象(例如图像)提供了一些特定的 ORDSYS 类型,这些对象还附加了一堆元数据,并具有相关的方法(例如重新缩放或重新着色图像)。
回答by abhay kumar
any large single block of data stored in a database, such as a picture or sound file, which does not include record fields, and cannot be directly searched by the database's search engine.
存储在数据库中的任何大的单个数据块,例如图片或声音文件,不包括记录字段,并且不能被数据库的搜索引擎直接搜索。
回答by Greg
A BLOB is a Binary Large OBject. It is used to store large quantities of binary data in a database.
BLOB 是二进制大对象。它用于在数据库中存储大量二进制数据。
You can use it to store any kind of binary data that you want, includes images, video, or any other kind of binary data that you wish to store.
您可以使用它来存储您想要的任何类型的二进制数据,包括图像、视频或您想要存储的任何其他类型的二进制数据。
Different DBMSes treat BLOBs in different ways; you should read the documentation of the databases you are interested in to see how (and if) they handle BLOBs.
不同的 DBMS 以不同的方式处理 BLOB;您应该阅读您感兴趣的数据库的文档,以了解它们如何(以及是否)处理 BLOB。
回答by sep15ms
They are binary large objects, you can use them to store binary data such as images or serialized objects among other things.
它们是二进制大对象,您可以使用它们来存储二进制数据,例如图像或序列化对象等。
回答by Val
I think of it as a large array of binary data. The usability of BLOB follows immediately from the limited bandwidth of the DB interface, it is not determined by the DB storage mechanisms. No matter how you store the large piece of data, the only way to store and retrieve is the narrow database interface. The database is a bottleneck of the system. Why to use it as a file server, which can easily be distributed? Normally you do not want to download the BLOB. You just want the DB to store your BLOB urls. Deposite the BLOBs on a separate file server. Then, you reliefe the precious DB connection and provide unlimited bandwidth for large objects. This creates some issue of coherence though.
我认为它是一个大的二进制数据数组。BLOB 的可用性直接来自于 DB 接口的有限带宽,它不是由 DB 存储机制决定的。无论您如何存储大块数据,存储和检索的唯一方法是狭窄的数据库接口。数据库是系统的瓶颈。为什么要用它作为一个易于分发的文件服务器?通常您不想下载 BLOB。您只希望数据库存储您的 BLOB 网址。将 BLOB 存放在单独的文件服务器上。然后,您可以减轻宝贵的数据库连接并为大型对象提供无限带宽。但这会造成一些连贯性问题。