BLOBs

What is a BLOB?

The Term BLOB stands for Binary Large Object. A BLOB is a collection of data which is stored in a file which is then stored in a database or in a program. The BLOB itself is a raw file that is comprised of any amount of data that can even be several gigabytes in size. This data is then compressed into a single format that is what is persisted in a database. The data inside is simply stored in binary format, consisting of a huge amount of 0s and 1s. This means that this data is stored in its most “raw” format hat can only be interpreted by a computer or program. This means that in order to read this data it is a predicate, that a data type needs to be explicitly given in order to know how to read the data. The most seen examples of BLOBs being stored are:

  • Videos: “.avi”
  • Audios: “.mp3”
  • Images: “.jpeg”
  • Graphics: “.gif”

How are BLOBs used?

When being used in a database, the system is not able to read or deliver the information in the BLOB. As it is in binary format, the database only handles its storage and can only deliver the content, name of the file, and data type. This means that is impossible to use database functions to sort or filter or arrange BLOB data.

Different database systems store binary data in different formats. Most of the time, the DB system will not directly save the data in the table, it will only save reference to the external place where the file is stored. The structure of a database is not made to store a huge amount of data in a single field in a table.

There are even different terms used by database systems to describe large binary objects. The following systems describe them as such:

  • MySQL
    • Up to 0.255
    • KB: TINYBLOB
    • Up to 64 KB: BLOB
    • Up to 16 MB: MEDIUMBLOB
    • Up to 4 GB LONGBLOB
  • PostgreSQL
    • BYTEA
    • Object Identifier
  • Oracle
    • BLOB
  • Microsoft SQL Server
    • Binary
    • Varbinary
    • Text
    • Ntext

What are the advantages and disadvantages?

Advantages

  • BLOBs are a great option to add large binary data files to a database and can be easily referenced to
  • It is easy to set access rights using the database systems rights management features
  • Database backups, snapshots and dumps will pertain all the data stored in these files

Disadvantages

  • Not all database systems support BLOB storage. The types of databases that support this are Btree, Hash, and Heap databases
  • BLOBs are inefficient as they require a large amount of disk space to store and have a long access time
  • Backups, although possible and useful, take a long amount of time as the large amount of data as to be duplicated.

Leave a comment