Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/317037-neverending-report-mysql/
Share on other sites

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, ...

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?

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.