I am planning to store a json_encoded string on my database. I can’t precisely tell the length its going to be, but I’m pretty sure it will be long. My concern is which field type I am going to use for this, is it blob or text?
I prefer the one where I can save space as much as possible over fast searching, in any case I have other column where I should just index.
blobis usually for things like images, binaries etc.textshould be good enough for your case, or you can uselongtextwhich has even bigger space capacity if that’s really a concern.Searching-wise, since you are storing
json_encode‘d stuff, you’ll still need to calljson_decodeon it anyway for it to be useful in your application, I don’t think choice of datatype matters in this case.A better way is to normalize your database design instead of storing related stuff in one big string of json.