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

相關文章
相關標籤/搜索