[Gambas-user] Blob management

Benoît Minisini gambas at ...1...
Fri Jun 26 18:29:38 CEST 2009


> Form MySQL 5.1 Manual, page 603:
>
>   -  Data Type  -                              - Storage Required  -
> BLOB, TEXT                               L+2 bytes, where L < 2^16
> MEDIUMBLOB, MEDIUMTEXT     L+3 bytes, where L < 2^24
> LONGBLOB, LONGTEXT             L+4 bytes, where L < 2^32
>
>
> I just need  2^24 not 2^32. Since LONGBLOB is not a VARBLOB I thnik it will
> take all the space.
>
> But I'm not a mysql expert.
>
> Regards
>
>
> --
> David
>


Accorging to http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html:

Data Type		Storage Required

TINYBLOB, TINYTEXT   	L + 1 bytes, where L < 28 
BLOB, TEXT   		L + 2 bytes, where L < 216 
MEDIUMBLOB, MEDIUMTEXT	L + 3 bytes, where L < 224 
LONGBLOB, LONGTEXT   	L + 4 bytes, where L < 232 

[...]

TEXT and BLOB columns are implemented differently in the NDB Cluster storage 
engine, wherein each row in a TEXT column is made up of two separate parts. 
One of these is of fixed size (256 bytes), and is actually stored in the 
original table. The other consists of any data in excess of 256 bytes, which 
is stored in a hidden table. The rows in this second table are always 2,000 
bytes long. This means that the size of a TEXT column is 256 if size <= 256 
(where size represents the size of the row); otherwise, the size is 256 + size 
+ (2000 – (size – 256) % 2000).

So you will lose one byte by using a LONGBLOB instead of a MEDIUMBLOB.

Regards,

-- 
Benoît




More information about the User mailing list