J
J
J. Snow2020-05-13 20:07:53
MySQL
J. Snow, 2020-05-13 20:07:53

When does it make sense to use BINARY instead of CHAR?

Hi all!

On my site, as identifiers (user ID, company ID, etc.), I use a fixed-length string in base62 format (for example: xQkmfxYVBLicFvaw2ECL).
I plan to store it in the database in BINARY format, or with ascii_bin comparison, because I don't need characters (I don't need to sort the base by ID).

Question:
Am I doing the right thing? :)
Will there be an increase in speed when reading and pasting? Are there any downsides to this approach?

Question 2:
Will there be a difference between BINARY and ascii_bin ?

Another question:
Maybe it makes sense to store in BINARY not only ID, but in general any things that do not require sorting?
For example session-ID, email, password-hash.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question