Mysql convert function performance test

Source: Internet
Author: User
To meet this requirement, the database needs to be sorted by Alphabet, while the mysql database uses utf encoding.
If gbk is used, the sorting rules are in pinyin format.
The convert function in mysql can convert data.
We have carried out a simple performance test on this convert. The following describes the test process and test results. If you have any questions, please point out.

Software and hardware environment

Hardware configuration: 2-core CPU, 2 GB memory

Database: Mysql 5.5
Table structure

     
1
2
3
4
5
     
Create table 'test _ gbk '(
'Id' int (11) not null AUTO_INCREMENT,
'Name' varchar (12) default null,
Primary key ('id ')
) ENGINE = InnoDB

 

Test cases

Test SQL:
Select * from test_gbk order by convert (name using gbk) limit 1;

Select * from test_gbk order by name limit 1 ;"

Test Objectives

Use the preceding two SQL statements to test the stress test of 4 threads and 16 threads respectively, focusing on QPS

Test results

40 thousand rows of data

4 threads, performance down 14%

16 threads with a performance reduction of 17%

10 thousand rows of data

 
4 threads, performance down 15%

16 threads with a performance reduction of 15%

Conclusion

From a simple test, we can see that, Performance drops within the range of 14%-17%.
Whether or not you want to use this function.
My suggestion is not to use it whenever possible, because compared with front-end applications, I think the computing resources of database servers are more precious.
Related Article

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.