2

What is the best data types for serialize data?

3 Answers 3

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

VARCHAR only if the size of the data does not exceed about 65k bytes, the maximum row size (though this is for all fields in the table, not just for a single field).
1

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

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.