开发者

Serialize data on mysql data types

开发者 https://www.devze.com 2023-02-25 04:18 出处:网络
What is the best data types for seri开发者_运维技巧alize data?if you know how long the serialized data will be you can use varchar, otherwise id use text. it might just be best to use text anyways.It

What is the best data types for seri开发者_运维技巧alize data?


if you know how long the serialized data will be you can use varchar, otherwise id use text. it might just be best to use text anyways.


It depends on how big the data you want to serialize is. It could be text or longtext.

Btw, very often (but not always) storing of serialized data is a bad design, which should be reimplemented using N:M or 1:N (many-to-many or one-to-many) relations


If the data is just a generic pile of bytes, such as an image, then use a BLOB.

If it's a pile of text, use one of the TEXT types.

Otherwise, it depends upon what kind of data you're dealing with.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号