在MySQL中处理巨大的Blob? [英] Handling of huge Blobs in MySQL?

查看:182
本文介绍了在MySQL中处理巨大的Blob?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将巨大的BLOB插入MySQL数据库(InnoDB)?

根据MySQL手册,LONGBLOB类型的字段最多支持4 GB的数据大小.但是,如此巨大的数据如何进入数据库?

我尝试使用

INSERT INTO table (bindata) VALUES ( LOAD_FILE('c:/tmp/hugefile') );

,如果hugefile的大小大于500 MB,则失败.我已将max_allowed_packet设置为适当的大小; innodb_buffer_pool_size的值似乎没有影响.

我的服务器计算机运行Windows Server 2003,并具有2 GB RAM.我正在使用MySQL 5.0.74-enterprise-nt.

解决方案

BLOB缓存在内存中,这就是为什么将BLOB的 3 副本插入数据库的原因./p>

您的500 MB BLOB占用1,500 MB RAM,这似乎已超出您的内存限制.

How can I insert huge BLOBs into a MySQL database (InnoDB)?

Fields of type LONGBLOB support data sizes of up to 4 GB according to the MySQL manual. But how does data of such a huge size get into the database?

I tried to use

INSERT INTO table (bindata) VALUES ( LOAD_FILE('c:/tmp/hugefile') );

which fails if the size of hugefile is bigger than about 500 MB. I have set max_allowed_packet to an appropriate size; the value of innodb_buffer_pool_size doesn't seem to have an influence.

My server machine runs Windows Server 2003 and has 2 GB RAM. I'm using MySQL 5.0.74-enterprise-nt.

解决方案

BLOBs are cached in memory, that's why you will have 3 copies of a BLOB as you are inserting it into a database.

Your 500 MB BLOB occupies 1,500 MB in RAM, which seems to hit your memory limit.

这篇关于在MySQL中处理巨大的Blob?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆