Frage

Always wondered if is there any essential difference in terms of speed in queries, when using VARCHAR 255 or VARCHAR 55 fields (for example).

What i mean is, if i slim down a VARCHAR 255 field to a maxlength of VARCHAR 55, do i'll get any benefit, if yes which does?

thank you

War es hilfreich?

Lösung

There is not real difference between VARCHAR(55) and VARCHAR(255) other than the number of characters it will allow. Both use one byte to store the length followed by the data so These two examples would be the exact same when storing any data of 55 characters or less. The threshold for a difference is 255. Anything longer will use two bytes for the length. As long as you stay at or below that, columns with any max length are basically the same.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top