Solved

timeout expired

Posted on 2008-06-10
6
294 Views
Last Modified: 2010-04-21
I get the following error because of a network issue we are having. We still havent figured out where the problem is. Here is the error:

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

I always get the error in the following stored procedure:

CREATE PROCEDURE spGetItemRackCounter
@fdRackType as int,
@fdItemOrderId as int,
@fdReturn1 int output
AS
Begin
      SELECT @fdReturn1 = Count(fdAssemblyBarcode)
      FROM tbStation5
      WHERE fdItemOrderId = @fdItemOrderId
      IF @fdReturn1 is null
      Select @fdReturn1 = 0
End
GO

I cant figure out why I get the error only when the program is accessing this stored proc but not the other stored procedures. I have about 20 stored procedures accessing tbStation5 table. And altogether about 60 stored procedures in this database. There are also 297772 records in tbStation5 table. What can I do to improve this stored procedure or table? If I add an index where should I add it to? Will that make things better?

Also the reason I say it is a network problem is because I get the error at certain times. Every day between 8:00 AM  9:00 AM and 12:00 PM 1:00 PM, and around 2:00 AM.
0
Comment
Question by:shamif
  • 3
  • 3
6 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 21752853
try this:

CREATE PROCEDURE spGetItemRackCounter
@fdRackType as int,
@fdItemOrderId as int,
@fdReturn1 int output
AS
Begin
      SELECT @fdReturn1 = Count(fdAssemblyBarcode)
      FROM tbStation5 with(nolock)
      WHERE fdItemOrderId = @fdItemOrderId
      IF @fdReturn1 is null
      Select @fdReturn1 = 0
End
GO
0
 

Author Comment

by:shamif
ID: 21761209
I put with (nolock) but I am still getting timeout errors. I don't see how nolock can fix the problem.
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 21762071
Do you have an index on the fdItemOrderId  field?
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

Author Comment

by:shamif
ID: 21762129
no I don't
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 125 total points
ID: 21762181
You definetly want one on there if you're searching through a lot of records....it may not fix everything, but it is going to help.

create nonclustered index tbStation4_OrderID on tbStation5(fdItemOrderId)
0
 

Author Closing Comment

by:shamif
ID: 31465812
Putting an index helped. The timeout error went to different stored procedure. I think we have to fix the root of the problem. But thank you for your help.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now