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”.html

BLOB是二进制大object,能够存储更多的数据。BLOB类型有四种TINYBLOB,BLOB,MEDIUMBLOB和LONGBLOB,每种类型最大长度值不一样。mysql

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

 

 

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类型。ui

使用磁盘操做会引起性能降低,所以包括BLOB和TEXT列的查询,最好是须要才查询,避免使用SELECT * 操做code

 

【参考资料】orm

一、http://dev.mysql.com/doc/refman/5.6/en/blob.htmlserver

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

相关文章
相关标签/搜索