RE: Delay in calls to stored procedure



1. What kind of load does the server have under normal wear and what kind of
load under burst? (sounds like burst is the issue here)
2. Are you using locking hints in your stored procedure? I would guess no.

There are other questions that could be asked, as well, but #1 will help
determine the cause of slowdown, while 2 will help show cause. Watch for
deadlocks while you are running, as that info will tell you whether or not
locking hints will have a great impact.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Joe" wrote:

> I'm running through a loop calling a stored procedure each time. I prepare
> the SqlCommand before entering the loop and just change the param values in
> the loop before each call to ExecuteNonQuery(). The problem I get is it's
> taking anywhere from 1/4 - 1/2 second before each call is made. I verified
> this using the SQL Profiler and comparing the start times of each call. The
> start and complete times are the same so the SP is executing very fast.
>
> What's even weirder is that this doesn't happen all the time. Some times it
> runs very, very fast.
>
> The application is being run on the database server and I'm using the IP
> address in the ConnectionString.
>
> The loop its self it pretty simple
>
> foreach (Item i in Items)
> {
> int itemRow = dataview.Find(a string) // note this dataview contains
> 8800 records
>
> if (itemRow == -1)
> continue;
>
> // assign param values
> ....
>
> try
> {
> cmd.ExecuteNonQuery()
> }
> catch (Exception ex)
> {
> LogMsg...
> }
> }
>
> Any suggestions would be greatly appreciated.
>
> -Joe
>
>
>
.



Relevant Pages

  • Re: Inserting taking to long time System.Data.OracleClient
    ... the load and recreate them after the load. ... for the command and set their directions Outside of the loop. ... It may be a server issue that can only be ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Threading and returning values
    ... The e.Result is not coming out of the loop. ... I have now got my SMTP server apparently running correctly now, ... BackgroundWorker bw = new BackgroundWorker; ... // Note that in the Click event handler, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... If you think I'm giving a verbose pseud write access to my server, ... interface appears in C Sharp as consisting of sbyte arrays. ... failed to see that a for loop is not just a while loop because a while ... chilling effect on freedom of speech. ...
    (comp.programming)
  • Re: multiple tcp server and client execution with close problem
    ... Ignore the loop for accept. ... for acceptafter settting socket to blocking mode. ... Client side: ... execute main to run server 3 times: ...
    (comp.unix.programmer)
  • Re: client-server network
    ... sent by server didn't reach the client...... ... nRet = WSAStartup; ... server scoket, and this would be binding some other random socket value, apparently the ... If you make this a server loop, it should be 'continue', not 'return'. ...
    (microsoft.public.vc.mfc)