With regard to the performance, integrity, and disk storage in the database layer, I wouldn't worry about it.
- Variable-length data like varchar, text, and blob is stored without padding.
- I don't know any issues with integrity. All data types are treated atomically by the database engine.
- Of course if you have really long text data then it will take more storage and more time for disk I/O and network bandwidth when you fetch that data. But if that's the data you need to put in the database, then that's what you have to do.
I can think of one possible impact:
Some client interface libraries pre-allocate a buffer to hold results, and they allocate enough memory for the largest possible value, since the client doesn't know the data until you fetch.
Therefore the library would allocate 16MB per mediumtext
while it would allocate 64KB for a text
. This is something to watch out for if you have a low memory limit in your client layer. For instance, PHP has a memory_limit
config parameter for scripts, and the buffer allocated for data result sets would count toward this.