MarkZA79 Posted July 2, 2023 Share Posted July 2, 2023 Hi Guys Hope you are all well. So just some background first. I have inherited a PHP system written by a previous no long gone Developer. None of my current team including myself are PHP developers so to date our troubleshooting so has been mostly googling and Trial and Error. The problem we face is we have these PHP reports which when run can take up to 30 minutes to return or others just never return at all The weird thing though is if I take the SQL that is being run and execute it in the console it returns in under a second So I am not sure where the bottleneck is when run from the Browser and PHP page I am also not sure how to even start debugging this To note it is a Linux Debian Box and the Browser I am running directly on the same box so as to eliminate any network issues as the cause for the slowness I am hoping that this forum can assist me in where to look or even just how to begin debugging the issue Thanks Mark Quote Link to comment https://forums.phpfreaks.com/topic/317037-neverending-report-mysql/ Share on other sites More sharing options...
mac_gyver Posted July 2, 2023 Share Posted July 2, 2023 if you post all the code, less the database connection credentials, someone can provide suggestions on what to start checking. if there's nothing obvious that the code is doing, then you would need to start by profiling/timing the execution of the query(ies) when executed via the php script, to see how long they are taking. however, just based on the symptom, it is likely the php code is doing something extremely inefficient, such as running queries inside of loops, operating on sets of data discreetly, rather than to use php array functions to operate on the set all at once, ... Quote Link to comment https://forums.phpfreaks.com/topic/317037-neverending-report-mysql/#findComment-1610175 Share on other sites More sharing options...
requinix Posted July 2, 2023 Share Posted July 2, 2023 1 hour ago, MarkZA79 said: The problem we face is we have these PHP reports which when run can take up to 30 minutes to return or others just never return at all Has it always been slow/occasionally not returning, or did that change recently? Quote Link to comment https://forums.phpfreaks.com/topic/317037-neverending-report-mysql/#findComment-1610177 Share on other sites More sharing options...
ginerjm Posted July 2, 2023 Share Posted July 2, 2023 How big is this report? How many records are being read to produce it? And - most importantly - is the data being collected with a single query execution or is the query to gather it run repeatedly from inside a loop? That would be a bad process and it would definitely slow things down if it involved hundreds of query exections. Quote Link to comment https://forums.phpfreaks.com/topic/317037-neverending-report-mysql/#findComment-1610182 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.