我们有一个非常大的历史表格,其中包含一列最多500个UTF8字符,而且磁盘空间增长得非常快!
我们每天至少有200万行...我们想知道哪个更好(主要是在存储方面,但也涉及性能)?TEXT还是VARCHAR(512)?
来自MySQL手册:
In most respects, you can regard a BLOB column as a VARBINARY column that can be as large as you like. Similarly, you can regard a TEXT column as a VARCHAR column. BLOB and TEXT differ from VARBINARY and VARCHAR in the following ways:
There is no trailing-space removal for BLOB and TEXT columns when values
are stored or retrieved. Before MySQL 5.0.3, this differs from VARBINARY and VARCHAR, for which trailing spaces are removed when values are stored.
On comparisons, TEXT is space extended to fit the compared object,
exactly like CHAR and VARCHAR.
For indexes on BLOB and TEXT columns, you must specify an index
prefix length. For CHAR and VARCHAR, a prefix length is optional. See Section 7.5.1, “Column Indexes”.
BLOB and TEXT columns cannot have DEFAULT values.