E
E
evil0o2015-10-28 22:35:07
MySQL
evil0o, 2015-10-28 22:35:07

What length should be given to a varchar column for maximum performance?

What to set the length of a column of type varchar 254 or 255?
mysql database innodb table view

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrew, 2015-10-28
@R0dger

Reading the documentation - dev.mysql.com/doc/refman/5.7/en/storage-requiremen...
VARCHAR(M), VARBINARY(M) - L + 1 bytes if column values ​​require 0 − 255 bytes, L + 2 bytes if values ​​may require more than 255 bytes
But imho it will still be slow with such a large varchar and even a key..

A
Aleksey Ratnikov, 2015-10-28
@mahoho

Ask as much as you really need, no need to overcap. Will work quickly if to hang up an index (it is checked up).

M
Max, 2015-10-28
@MaxDukov

What are you going to store there? In principle, a simple char, if the length of the field is known in advance, will be better.

A
AlexKuznec, 2016-12-02
@AlexKuznec

For example, Yii2 creates varchar(255) in migrations by default

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question