Does MySQL have a fixed length of char? Why do you say it's more efficient than varchar?

Source: Internet
Author: User

Many tutorials say varchar (here with varchar (5) example, UTF-8 encoding) the data stored in the database is not long, such as you save "AB" and "in", one occupies 2 bytes, one occupies 3 bytes, because in the disk storage when the number of bytes is different, so you need to record the length.
Is the MySQL char still fixed long when it is stored in Chinese? Kai Time Casino
For example char (5) I saved ' abc ' and saved ' big ' MySQL using space completion, one accounted for 5 bytes, and one accounted for 7 bytes.
The number of bytes occupied is still different ah, no still have fragments!

Does MySQL have a fixed length of char? Why do you say it's more efficient than varchar?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.