Does a mediumtext and a varchar(65535) are the same thing ? What I mean here is do they both store the data directly in the table or do the mediumtext type is storing a pointer ? I'm asking this because if I try to create a varchar(65535) it is automatically transform into a mediumtext (if the length is bigger than 21811 actually).
I've got another related question which is:
I've got some fields in a table that I want to be able to store a lot of characters (around 10'000). But in reality, it will almost all the time store no more than 10 characters.
So my question is, do I need to use a text or a varchar(10000) type for best performance ?
I believe a varchar type is more appropriate for this case.
Thanks in advance for your answers.
The thing I don't understand is why they say that since mysql 5.0.3, we can create a varchar(65535) but when we try to do this, it convert it to a mediumtext. For me the difference between varchar and text (mediumtext include) is the way how they are store (using a pointer or not). So why do they say that we can create varchar with a length of 65535 if we can't?
I'm answering to my own question:
That's because I'm using a multi-byte character. If you use an utf-8 collation, you will not be able to create a varchar with about more than 21000 chars. But if you use ascii, you will.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With