How to correctly select MySQL data column type

Source: Internet
Author: User

MySQL data column type selection is a common problem when we design the table, below teaches you how to correctly select the MySQL data column type, for your reference to learn.

Choosing the Right data column type can greatly improve the performance of the database and make the database highly scalable. When choosing a MySQL data column type, consider the following:

The type of data that is stored in the data column.

The value range of the data value.

Consider performance and processing efficiency.

Numeric manipulation is faster than character manipulation.

Small types of processing speed are faster than large types.

Fixed-length types and variable-length types have different processing efficiencies in different data tables.

Variable-length types are prone to fragmentation after deletion and modification, reduce system performance, and need to run the Optimize Table command regularly to optimize the data tables.

Fixed length types have fixed lengths, so it is easy to determine the starting point for each record to speed up the repair of data tables.

The use of fixed-length type data columns in MyISAM and ISAM tables helps improve database performance.

In the InnoDB table, fixed-length and variable-length data column types are stored in the same way, so fixed-length data column types do not have a performance advantage, but because the data column types with the available length have less storage space, processing speeds are faster.

An indexed type can speed up the query of data.

Explicitly specifying the NOT NULL property of a data column allows MySQL to speed up processing by not having to determine whether the data column is null during retrieval.

How the data is compared and case-sensitive.

Whether to index on the data column.

How to correctly select MySQL data column type

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.