Data Query efficiency: thinkphp11, 0.09 data usage:

Source: Internet
Author: User
Data Query efficiency: thinkphp11, 0.09 data usage:
// The code uses this statement to check whether the data exists. $ sourceurl = $ User-> where ($ condition)-> select (); // The query result returned by MySQL is null (zero rows ). (The query takes 0.0948 seconds) SELECT * FROM 'yuyu _ comment' WHERE ('objectid' = 6120) AND ('membername' = 'j *** 4 ')


It is terrible to judge whether a user has used 0.09 of comments to query each time more than 20 comments are added up slowly!

Is there any other solution?


Reply to discussion (solution)

0.1 seconds is not too slow
In addition, create an index on objectid and membername.

0.1 seconds is not too slow
In addition, create an index on objectid and membername.


3Q board I thought it was a problem with my statements
However, I have never been familiar with indexing and reading online tutorials!
Are there any easy-to-understand tutorials?

There is nothing difficult to create an index. just click it in the management tool.

Simply put, an index is to put the same content together. Obviously, it's much faster to pick it up.
After the index is created, the content is sorted. During retrieval, it changes from sequential search to binary search.
0.11 million records, worst case
Search for 0.11 million times in sequence
The second query is performed 17 times.


Thanks for the fact that the board has more data. just click the index.

I have read the online tutorials. they are too complicated. it may be that the indexing tool is so simple.

After the index is created, it is maintained by the database itself. you no longer need to work.

After the index is created, it is maintained by the database itself. you no longer need to work.

Thanks for helping me solve a headache. The website is flying again.

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.