0

I tried this How can I avoid connection timeout when the same php file runs multiple times but although the extended time limit works (true is returned by the function set_time_limit) I still get the error "Error occurred: SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query".

I have a lot of data to grab, and I used to grab the data separately, for separate conditions. For example if the year was changed to 2013, all the data for 2013 was grabbed and that took 30-60 seconds. To avoid that long wait time, I changed it so that at the beginning when the page is loaded, all the data of all years is grabbed in a for loop which would obviously take longer but when interacting with the data there would at least be no wait time. So now it runs xmlhttp.open() for each year, a total of 5 times (my data is form 2010-2015) and am now getting this error. Is there anything else I can do to extend the timeout?

Thank you

User
  • 51
  • 3
  • There's very little to go on here. We don't know what system you're using, or how long you allow your script to run. Just remember you're running 5 queries simultaneous on the same data, so it will be (a lot) slower than when you run 1 query. The best thing to do is probably to restructure your database so it doesn't take so long. – KIKO Software Jul 06 '20 at 19:19
  • How much data are you loading? Do you need to load everything? If you need some pointers on how to optimize, please post some relevant code and a DB table schema. – Markus AO Jul 06 '20 at 19:48

0 Answers0