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.