How to quickly query table data

Source: Internet
Author: User
How can I quickly query the table data? for your own reasons, two fields of the data in the entire table of the group buying table have an error. you need to retrieve the data table, in the group purchase table, I chose not to update because the data volume is larger than that in the school. I created another Table B, I used a program to control such an SQL loop. The entire group buying table Aselect * fromtuangouAlimi asked for help: how can I quickly query the table data?
For your own reasons, two fields of data in the entire table of the group buying table have an error. you need to retrieve the data table and update it to the group buying table,
I did not choose to update because the data volume is larger than the school data volume,
I have created another Table B. I use A program to control this SQL loop. The entire group buying Table
Select * from tuangouA limit 0,600;
Select * from tuangouA limit 600,600;
Select * from tuangouA limit 1200,600;

At the beginning, the speed is quite fast, but when the base number reaches


Select * from tuangouA limit 600x,10;

It takes more than four seconds for me to retrieve 10 pieces of data. at this speed, I don't know when to run it. 6 million RMB is just half the data of my table, so I am very anxious, but I cannot find other methods.
Do you have any good methods.



------ Solution --------------------
Set id as the primary key, and id is continuous
Select * from tuangouA where id> = 6000000 limit 10;

------ Solution --------------------
If you get less data each time, you get less than 10000 cycles each time.
------ Solution --------------------
Discussion

Set id as the primary key, and id is continuous
Select * from tuangouA where id> = 6000000 limit 10;

------ Solution --------------------
Too many data can be split into tables
------ Solution --------------------
It is neither a conditional query nor a slow query.
------ Solution --------------------
If you do not want to select all, do not use select * to use the select field from. in this case, select * is faster, but the use of order by is more obvious.
------ Solution --------------------
See the following section for high-performance MySQL (2nd)

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.