List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 1 1999 10:46pm
Subject:Inserting a "large" file
View as plain text  
>>>>> "Kip" == Kip Cranford <kip_cr@stripped> writes:

Kip> I'm using MySQL version 3.22.25, with DBI 1.13,
Kip> mysql-modules 1.22 and perl 5.005.

Kip> I'm trying to insert a large file into mysql, inside a
Kip> blob column.  I always receive the 'MySQL server has
Kip> gone away' error.  I have reviewed the documentation,
Kip> and the list archives, and am running the mysqld with
Kip> the max_allowed_packet=50M...

Kip> Through trial and error, I've been able to insert a
Kip> file up to about 15MB before getting the error --
Kip> anything larger fails.  Now, I'm assuming that the
Kip> success of a large insertion will depend on my
Kip> machine's memory capacity as well.  I've got 128MB
Kip> installed, and about 64 MB "free" when I try to run
Kip> the test insertion script.

Kip> So, if it is strictly a problem with the amount of RAM
Kip> I have, it seems impossible to ever get larger files
Kip> inserted into my databases.  Are there other ways to
Kip> go about this type of insertion, instead of trying to
Kip> do the full insertion in one operation?  How are
Kip> others doing large insertions?

Kip> Any help would be greatly appreciated.


The MySQL protocol was only designed to handle packets up to 24M. This 
means that you can for the moment only insert rows that after escaping 
will be less than 24M.

It's not that hard to change this (you only have to fix this in
sql/ (which should be identical to) client/, but we don't
plan to do this in the general distributions for a while.

If you have very large blobs, it may be better to store them in files.

Another option is to upgrade to 3.23 and use the command LOAD_FILE()
to read the blob into the server.

Inserting a "large" fileKip Cranford1 Sep
  • Inserting a "large" fileMichael Widenius2 Sep