Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

the longblob is the biggest data type of Mysql. If I want to save something bigger than 4gb (longblob) how can I do?.

I'm talking about Mysql v-5.+

share|improve this question
1  
Maybe you should tell us what you are trying to do. Putting something directly into a DB that is greater than 4GB seems like a design problem to me. –  JNK May 1 '12 at 19:43
    
I'm not trying to save anything, that question just came to my head. Lets pretend I want to put a bluray directly (around 20gb or more) into the DB –  jcho360 May 1 '12 at 19:58
2  
Then my response to you would be "put the bluray on a disk and put a pointer or path to the data in the DB" –  JNK May 1 '12 at 19:59

2 Answers 2

up vote 5 down vote accepted

Using LONGBLOB can be very risky in light of the fact that the biggest max_allowed_packet is only 1GB.

Back in August 2006, someone asked a similar question. in which Peter Zaitsev said:

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

As you can see in theory it is about 4GB.

It is however also limited by max_packet_size which is 16M by default.

I would be very careful using blobs larger than 100MB. MySQL will need some 3 times of this size of memory allocated on the server for blob processing.

I am not a PostgreSQL DBA, but I would have to venture the following suggestion:

  • If you must store objects that big, you should go with PostgreSQL because it has a storage infrastructure called the The Outside Attribute Storage Technique (TOAST). This allows rows not to be too big for SQL processing.
  • If you must use MySQL, you are much better off storing URL File Links than the BLOB itself.
share|improve this answer

If you really want to store in mysql, then perhaps you could store it using chunks, meaning that you make an algorithm that takes your data and store it in the database in chunks - this ofcourse makes the programming a bit more difficult when retrieving the data, since you have to do the opposite, but this type of technique could solve your problem

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.