ajax simple request slow

WBOY
Release: 2016-08-08 09:06:54
Original
1053 people have browsed it

ajax simple request slow

ajax simple request slow

ajax simple request slow

There are only a few records in the data table. The query should be very fast. Why does this request take so long? (The request is for the local server)

Checked the data query time, this is where time wasted

ajax simple request slow

ajax simple request slow

ajax simple request slow

The database only has these 10 rows of data, and parentid is also indexed. Why is the query so slow?

ajax simple request slow
It takes 0.001s to execute the query directly on phpmyadmin

Reply content:

ajax simple request slow

ajax simple request slow

ajax simple request slow

There are only a few records in the data table. The query should be very fast. Why does this request take so long? (The request is for the local server)

Checked the data query time, this is where time wasted

ajax simple request slow

ajax simple request slow

ajax simple request slow

The database only has these 10 rows of data, and parentid is also indexed. Why is the query so slow?

ajax simple request slow
It takes 0.001s to execute the query directly on phpmyadmin

The url query string used by ajax, and there is nothing in the data. I guess this delay is because both the front end and the back end are waiting for the empty data package, so you can try using the get method directly, or you can use the get method in the data package. You can also create a FormData in it

The person above is right. I suggest you change it like this. Change the for loop in JavaScript to this:

<code class="javascript">for(var i=0;i<count;i++) {
    function() {
        //your code
    }
}</code>
Copy after login

You can try it.

The problem may not be in the code, try using 127.0.0.1 instead of localhost

Test a few more times to see if it is a coincidence?
It may be a problem with the back-end code. Can you comment out other irrelevant codes and try?

Is there a problem with the database and the connection access speed is too slow?

1. Modify POST request to GET request
2. select Modify to select fileds Specific fields, avoid using wildcards
3.desc Or explain your SQL and see if indexes are used

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template