MySQL中的VARCHAR(255)和TINYTEXT字符串类型有什么区别? [英] What's the difference between VARCHAR(255) and TINYTEXT string types in MySQL?

查看:1604
本文介绍了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?

推荐答案

您不能将DEFAULT值分配给TINYTEXT,也不能在后者上创建无前缀索引.

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字符串类型有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆