TEXT和BLOB区别

BLOB is a binary large object that can hold a variable amount of data. The four BLOB types are TINYBLOBBLOB,MEDIUMBLOB, and LONGBLOB. These differ only in the maximum length of the values they can hold. The four TEXTtypes are TINYTEXTTEXTMEDIUMTEXT, and LONGTEXT. These correspond to the four BLOB types and have the same maximum lengths and storage requirements. See Section 11.7, “Data Type Storage Requirements”.

BLOB是二进制大object,可以存储更多的数据。BLOB类型有四种TINYBLOB,BLOB,MEDIUMBLOB和LONGBLOB,每种类型最大长度值不同。

TEXT有四种类型,TINYTEXT,TEXT,MEDIUMTEXT,LONGTEXT类型。

 

 

Instances of BLOB or TEXT columns in the result of a query that is processed using a temporary table causes the server to use a table on disk rather than in memory because the MEMORY storage engine does not support those data types (see Section 8.4.4, “How MySQL Uses Internal Temporary Tables”). Use of disk incurs a performance penalty, so include BLOB or TEXT columns in the query result only if they are really needed. For example, avoid using SELECT *, which selects all columns.

BLOB和TEXT在查询的时候会使用临时表,从而引起磁盘操作,因为内存型存储类型不支持TEXT和BLOB类型。

使用磁盘操作会引发性能下降,因此包括BLOB和TEXT列的查询,最好是需要才查询,避免使用SELECT * 操作

 

【参考资料】

1、http://dev.mysql.com/doc/refman/5.6/en/blob.html

2、http://imysql.com/2014/09/28/mysql-optimization-case-blob-stored-in-innodb-optimization.shtml

posted @   小郭学路  阅读(388)  评论(0编辑  收藏  举报
编辑推荐:
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
· dotnet 源代码生成器分析器入门
阅读排行:
· ThreeJs-16智慧城市项目(重磅以及未来发展ai)
· 软件产品开发中常见的10个问题及处理方法
· Vite CVE-2025-30208 安全漏洞
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(四):结合BotSharp
· MQ 如何保证数据一致性?
历史上的今天:
2013-10-11 raid卡MegaCli工具使用说明
2013-10-11 Python之上下文管理
点击右上角即可分享
微信分享提示