TINYBLOB, BLOB, MEDIUMBLOB and LONGBLOB in MySQL

Home » Guides » TINYBLOB, BLOB, MEDIUMBLOB and LONGBLOB in MySQL

TINYBLOB, BLOB, MEDIUMBLOB and LONGBLOB in MySQL

The BLOB data type comes in four different types, each with a varying maximum length of data it can hold: TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB. Let's explore the specifics of each type.

What is a BLOB?

A binary large object (BLOB) is a data structure capable of holding a variable amount of binary data. The BLOB data type comes in four different types, each with a varying maximum length of data it can hold: TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB.

BLOB Types in MySQL

To delve into the specifics, let's explore the maximum lengths and storage requirements for each type:

  1. TINYBLOB: This type can store up to 255 bytes of binary data. Each TINYBLOB value is accompanied by a one-byte length prefix that indicates the number of bytes within the value.

  2. BLOB: With a maximum capacity of 65535 bytes (or 64KB) for binary data, the BLOB type utilizes a two-byte length prefix to represent the size of the value it stores.

  3. MEDIUMBLOB: This type has a larger storage capacity of 16777215 bytes (or 16MB). To represent the length of the binary data, each MEDIUMBLOB value is accompanied by a three-byte length prefix.

  4. LONGBLOB: The LONGBLOB type reigns supreme in terms of storage, enabling a maximum length of 4294967295 bytes (or 4GB). A four-byte length prefix serves to represent the size of the stored binary data.

The BLOB data type offers a range of options for storing binary data, allowing for flexibility based on the size requirements of the information at hand.


Details

  • Title: TINYBLOB, BLOB, MEDIUMBLOB and LONGBLOB in MySQL
  • Published:
  • Author:
  • Categories: SQL Guides
Top Hosting Providers
Price

Want help?

Sometimes it can be hard to make a choice. Have you still not foun the information you're looking for, or are you wondering about something specific? Get in touch and we'll help you out.

Get in touch