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.
精彩评论