How to improve execution efficiency

Source: Internet
Author: User
How to improve execution efficiency
for($i=0; $i
 ';mysql_query($sql);}


There are more than 6000 records. if insert into is executed for each record, it takes a long time and exceeds the default 90 s. Is there any way to improve execution efficiency?


Reply to discussion (solution)

Error message:
Maximum execution time of 90 seconds exceeded

You can write the array to be inserted to the array first, and then insert the array in a unified manner.

For ($ I = 0; $ I
  
  

Error message:
Maximum execution time of 90 seconds exceeded

Time-out can be added to the header
Set_time_limit (0 );
?>

You can write the array to be inserted to the array first, and then insert the array in a unified manner.

For ($ I = 0; $ I
     
    

I tried it, but it was still very slow. Let me try set_time_limit (0. Thank you!

It must be slow to get $ r. only 6000 rows are slow. generally, it should be very fast!

It must be slow to get $ r. only 6000 rows are slow. generally, it should be very fast!
I posted the code. could you please help me.

$ File = 'upload/NGFile.txt ';
$ Str = file_get_contents ($ file) or die ("file opening failed ");
$ R = explode ("\ r \ n", $ str );

It is estimated that ngfile.txt is slow.
Now the society is already using hardware to adapt to software.
If you have a good server, you can do it.

It is estimated that ngfile.txt is slow.
Now the society is already using hardware to adapt to software.
If you have a good server, you can do it.
Thx

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.