R
R
rdt092016-09-06 16:51:20
MySQL
rdt09, 2016-09-06 16:51:20

Does this take away the benefit of using fixed-length strings?

As far as I understand, the main advantage of fixed-length strings over variable-length strings is the speed of accessing such columns. However , here in the comments they write:

Note that using CHAR will only speed up your access if the whole record is fixed size. That is, if you use any variable size object, you might as well make all of them variable size. You gain no speed by using a CHAR in a table that also contains a VARCHAR.

That is, if at least one field in the record is a string of variable length, then there will be no gain in speed. My table has a column that can take both short and long values, so I don't want to create a fixed row for it. It turns out that if I make it a variable string, then access to the rest of the fixed fields will become slower, even if it is not mentioned in the query?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly, 2016-09-06
@rdt09

To begin with, specify the number of rows in the table, there are not so many of them, then in principle there will be no difference. In general, yes, if the entire string does not have a fixed length, then the efficiency of CHAR will be less.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question