The way ADO retreives parameters from SQL Server

G

Guest

I have a question to which I hope someone has the answer. We have developed
an application that queries a database a great deal and speed is crucial. We
do all database operations utilizing stored procedures and return the
information in parameters since there would be only one row anyway.

We have noticed some interesting timing that is causing us problems in the
overlying process this applciation supports. By using Windows high
performance timers to measure the performance we have learned that sometimes
we'll have long delays (When I say long delay I mean between 150 to 600 mS.)
waiting for the ExecuteNonQuery to return. Other times (a little more rare)
we would have a long delay getting the parameters back after the
ExecuteNonQuery returned. Of course we try to retrieve the SQLParameters as
soon as the ExecuteNonQuery returns. That delay is measured from the time
the ExecuteNonQuery returns and the first SQLParameter is read out of ADO.
The time needs to stay below 100 mS. The delay doesn't happen very often
about once in every 100 or so attempts.

We are putting performance timers in SQL Server to determine the times the
stored procedures uses for processing and examining when the server
recompiles its stored procedures. So now for the question.

We are concerned with the delay ADO is giving us when we attempt to call the
SQLParameters collection. Do the parameters return to ADO on a background
thread that is spawned when the ExecuteNonQuery returns complete from the
stored procedure? If not does anyone know what might account for these
infrequent delays that we are seeing?

We are using Framework 1.1 SP 1.

Any help will is greatly appreciated.

Rob
 
W

William \(Bill\) Vaughn

Yes, I would use the Profiler to check the SP execution times, but I suspect
that you're seeing problems with the compiled query plan. When a SP is
executed, SS checks to see if there is a copy of the query plan in the
cache. If so, it's reused--even if the plan is not appropriate for the
current set of parameters. There are ways around this problem that involve
simplifying the SP, having a SP call other SPs when the logic demands it,
recompiling each time the SP is invoked and others.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top