3 ms·
> Does MySQL not have a TEXT data type It does, but it's still length limited--more precisely, there are several different TEXT data types, with different leng
by pdonis 9y ago
> Does MySQL not have a TEXT data type
It does, but it's still length limited--more precisely, there are several different TEXT data types, with different length limits. This bit me recently on a project, where I was sending strings over the length limit to a TEXT field and wondered why they got truncated until I read the spec more carefully.
- nerfhammer 9y agodoes the new json storage not re-use mysql's TEXT storage? It is stored directly on the data pages? But then it would be limited in length, or does it use something else entirely?
- pdonis 9y agoFrom the documentation[1], it looks like the underlying storage requirement is similar to what would be required to store the string representation of the JSON in a TEXT-type field; however, unlike TEXT fields, there is no length limit other than the global system variable max_allowed_packet (which defaults to 4 MB). [1] https://dev.mysql.com/doc/refman/8.0/en/storage-requirements.html#data-types-storage-reqs-json https://dev.mysql.com/doc/refman/8.0/en/storage-requirements...
- nerfhammer 9y agomax_allowed_packet seems like it would limit the length of any internal string, so maybe it would bound the max length of any individual json field contents?
- pdonis 9y agoThe documentation seems to me to say that max_allowed_packet limits the total size of the storage that a JSON field can take. Of course that also puts an implicit limit on the size of individual keys or values in a JSON object stored in the field, or elements of a JSON array.