MySQL optimization recommendations for existing tables

Source: Internet
Author: User

Author: skate
Time: 2012/05/24

 

MySQL analyzes existing tables and provides column-optimized data types to reduce the table size, for example, in French:

Select... from... where... procedure analyse ([max_elements, [max_memory])

 

Note:
Max_elements: (default value: 256) the maximum number of values that analyze follows when finding different values in each column. Analyze also uses this value to check whether the optimized data type is enum, if the number of different values in this column exceeds the value of max_elements, Enum is not recommended as the data type for optimization.

Max_memory: (default value: 8192) Maximum number of memories that can be allocated when analyze finds all different values in each column

Mysql> select parent_id from child procedure analyse (5, 2000) \ G
* *************************** 1. row ***************************
Field_name: Test. Child. parent_id
Min_value: NULL
Max_value: NULL
Min_length: 0
Max_length: 0
Empties_or_zeros: 0
Nulls: 0
Avg_value_or_avg_length: 0.0
STD: 0.0
Optimal_fieldtype: Char (0) not null // This is an optimization suggestion
1 row in SET (0.00 Sec)

 

After a certain period of time in the database production environment, the DBA can refer to the analysis results of analyze to optimize the table structure. To reduce tables
Size

 

---------- END ----------

 

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.