Savina Dimitrova
Savina Dimitrova

Reputation: 155

How to set the maximal size of BLOB column in MySQL?

I want to set the maximal size of a BLOB column to be up to 900KB.
Is there a way similar to the syntax of the other String Data types - for example

c CHAR(7),
vc VARCHAR(50),
pic BLOB (???)

to do this?

Upvotes: 1

Views: 6283

Answers (2)

Matt Clark
Matt Clark

Reputation: 28629

From the storage requirements section of the manual, the max size of the fields are as follows:

Field Length Bytes
TINYBLOB L < 2^8 256
BLOB L < 2^16 65,536
MEDIUMBLOB L < 2^24 16,777,216
LONGBLOB L < 2^32 4,294,967,296

In order to store 900KB, you would need to use a MEDIUMBLOB at the very minimum.

As far as I know, you cannot specify your own size for the field.

Upvotes: 5

Void
Void

Reputation: 1

With our IBM Database (AS400), it is possible to provide a size to a Blob field.

fieldName Blob(size in bytes)

The maximum Size is then visible like any other length

Screenshot from DBvisualizer:
https://i.sstatic.net/XIZaC.png

Upvotes: -2

Related Questions