What#39;s the difference between VARCHAR(255) and TINYTEXT string types in MySQL?(MySQL 中的 VARCHAR(255) 和 TINYTEXT 字符串类型有什么区别?)
问题描述
MySQL 中的 VARCHAR(255) 和 TINYTEXT 字符串类型有什么区别?
What's the difference between VARCHAR(255) and TINYTEXT string types in MySQL?
它们中的每一个都允许存储最大长度为 255 个字符的字符串.存储要求也相同.我什么时候应该更喜欢一个?
Each of them allows to store strings with a maximum length of 255 characters. Storage requirements are also the same. When should I prefer one over another?
推荐答案
您不能为 TINYTEXT 分配 DEFAULT 值,也不能在后者上创建无前缀索引.
You cannot assign a DEFAULT value to a TINYTEXT and you cannot create an unprefixed index on the latter.
在内部,额外的对象被分配到内存中来处理 TEXT(包括 TINYTEXT)列,这会导致大记录集上的内存碎片.
Internally, additional objects are allocated in memory to handle TEXT (incl. TINYTEXT) columns which can cause memory fragmentation on the large recordsets.
请注意,这仅涉及记录集中列的内部表示,而不涉及它们在磁盘上的存储方式.
Note that this only concerns the column's internal representation in the recordsets, not how they are stored on the disk.
这篇关于MySQL 中的 VARCHAR(255) 和 TINYTEXT 字符串类型有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL 中的 VARCHAR(255) 和 TINYTEXT 字符串类型有什么区别?
基础教程推荐
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 是否可以执行按位分组功能? 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 无法解决整理冲突 2021-01-01
