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 字符串类型有什么区别?
基础教程推荐
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 在多列上分布任意行 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
