MySQL optimization scheme

Source: Internet
Author: User

Optimization of SELECT * and select fields.

Let's start with a test, I have 260,000 records in my test database.

Check the number of columns again:

SELECT COUNT (*) from Information_schema.columns WHERE table_schema= "Lezhi_data ' and table_name= ' Demo_jobs_store ';

The return is 43 columns. This number as a test data should be able to have a preliminary effect.

Let's try the Select field first to find out how much response time is:

We can see that the execution of a field is 7.724 seconds.

Let's do two more fields to see how it works.

Two fields, the time is 15 seconds.

Let's be ruthless and add a few more fields. < yo "http://www.2cto.com/kf/ware/vc/" target= "_blank" class= "Keylink" >vcd4kpha+pgltzybzcmm9 "http://" Www.2cto.com/uploadfile/Collfiles/20140331/2014033109075048.jpg "alt=" ">

We can see the time directly to 29 seconds.

From the above we can see the great difference in execution time. PS, my first picture of the red box is wrong.

So in the actual application process, we try to select the fields we need.

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.