What column type should be used to store serialized data in a mysql db?

前端 未结 8 1568
余生分开走
余生分开走 2020-12-08 01:45

What column type should be used to store serialized data in a mysql db? I know you can use varbinary, blob, text. What\'s considered the best and why?

Edit: I unders

8条回答
  •  既然无缘
    2020-12-08 02:33

    Unless the serialized data has no other use than to be saved and restored from the database, you probably don't want to do it that way.

    Typically, serialized data has several fields which should be stored in the database as separate columns. It is common for every item of serialized data to be a separate column. Some of those columns would naturally be key fields. Additional columns might plausibly added besides the data to indicate the date+time of when the insertion occurred, the responsible user, etc., etc.

提交回复
热议问题