Jump to content

Execute query direct to database 3 seconds, pdo->execute 53 seconds.


iarp

Recommended Posts

Hi All, I am at a loss. I have a web server that used to run beautifully (IIS/PHP) and something has just caused it to tank.

 

I can run queries directly against the SQL Server database and get 700+ row results in 3 seconds. However when I connect via PDO, ->prepare the query and then ->execute the execution can take 50+ seconds to run. Even just a ->query takes the same length of time.

 

The query I am issue has no parameters, the values are hardcoded and controlled by me.

 

I'm at a loss as to what to look into next, nothing I do changes the time factor. I've tried turning off emulating prepares, but prepares happen instantly.

 

I've been tracking how long it takes and this is what my log looks like

START|2015-09-23 21:48:50
PREPARED|2015-09-23 21:48:50
EXECUTED|2015-09-23 21:49:43
FETCHED|2015-09-23 21:49:44
SENT|2015-09-23 21:49:44
Link to comment
Share on other sites

I decided to try running SQL Server Profiler to figure out if maybe SQL was taking forever to issue the query.

 

So I'm sitting here, Profiler on one screen and my test script on another. I refresh my test script and see the connection open within Profiler. It sits there for 50 seconds exactly, then I see the query gets issued to SQL, executed, 3 seconds later it returns all data.

Link to comment
Share on other sites

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.