Solved

Query timeout expired (ASP) but only 3 times then it it's okay

Posted on 2014-10-09
4
175 Views
Last Modified: 2014-10-22
Our CMS is experiencing 'Query timeout expired' after updating records.

But it only happens 3 times at the start of each day, then it no longer happens until the next day (odd).

CMS using ASP Classic code.

Starting happening after our IS/IT department upgraded to MS SQL Server 2008 R2.

Not sure why it's happening. I think the code stop is not always the same but in my last test it happened after a System.Connection.Execute.
0
Comment
Question by:intoxicated_curveball
  • 2
4 Comments
 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40370520
The first time a query runs takes always more time since there's nothing in the buffer. After that data are most expected to be in the buffer so the engine will get data from memory instead of from disk.
Anyway you should ask how they upgraded SQL Server. Check with them if they rebuild indexes after migration.
You can also post here the query so we can see if there's any improve that can be done.
0
 
LVL 26

Expert Comment

by:Dan McFadden
ID: 40370525
From what version of SQL server did you upgrade?  Depending on the version there may be syntax issues with some queries.  But that depends on from where you came.

What is the app trying to do when it tries to do the execute?

Using SQL Server Management Studio, have you tried to directly execute the query to see if data is being returned?

Dan
0
 

Author Comment

by:intoxicated_curveball
ID: 40370579
Vitor:

The query is

MaxRank = getInt(System.Connection.Execute("SELECT MAX(T.[Rank]) FROM [" & Me.Title & "] AS T")(0))

Open in new window


But I don't think it's always the same every day. I can't confirm until tomorrow since the issue will no longer happen today.

Dan:

Was SQL Server 2005 previously.

I don't see how it can be a syntax issue if there's no syntax error and it only happens three times (timeout) then doesn't happen again that day.

I will try the Query directly tomorrow.

Is there any way to just extend the Query timeout time?
0
 
LVL 46

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40370678
You can change the query timeout time in your connection but you should avoid that unless in extremely cases that are really necessary.
What can also happens is maybe somehow in the morning that table have a lot of simultaneous access so what you can do here is to use a NOLOCK locking hint:
MaxRank = getInt(System.Connection.Execute("SELECT MAX(T.[Rank]) FROM [" & Me.Title & "] AS T WITH (NOLOCK)")(0))

Open in new window

0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
email about the whoisactive result 7 30
Query / Window function ? 3 18
Trouble analysing a database 9 15
TSQL - How to use JOIN for two tables 7 6
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
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 INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

863 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

19 Experts available now in Live!

Get 1:1 Help Now