Wednesday, March 7, 2012

Query times out when executed from 1 server

I have a weird problem.
It all started when one of our clients reported having an error
accessing one of our pages. We found that the cause of the error
resulted in a timed-out query.
When we execute a certain query using Query analyser from our Web
Server, the query times out.
When executing exactly the same query using any other server/machine
with Query Analyser, the query runs within 1 second.
Same SQL Server, same database, same query.
We've pinpointed the problem to a nvarchar column containing the
substring "CO." in one of its returned value.
When we remove the point from the "CO.", the query runs without
problems from our web server.
Anybody has an idea of why this could happen and how we can prevent
this from happening.
Many Thanx.Hi,
Probably your statistics might be outdated. Could you execute a update
statistics on that table and try executing the query.
See the execution plan for the index usage as well.
Thanks
Hari
SQL Server MVP
"Alex V" <alex.vezeau@.gmail.com> wrote in message
news:1128706938.421519.122200@.g49g2000cwa.googlegroups.com...
>I have a weird problem.
> It all started when one of our clients reported having an error
> accessing one of our pages. We found that the cause of the error
> resulted in a timed-out query.
> When we execute a certain query using Query analyser from our Web
> Server, the query times out.
> When executing exactly the same query using any other server/machine
> with Query Analyser, the query runs within 1 second.
> Same SQL Server, same database, same query.
> We've pinpointed the problem to a nvarchar column containing the
> substring "CO." in one of its returned value.
> When we remove the point from the "CO.", the query runs without
> problems from our web server.
> Anybody has an idea of why this could happen and how we can prevent
> this from happening.
> Many Thanx.
>|||Updated the statistics and problem still there.|||Other example of timeout:
Select name as NAME_USER FROM USERTABLE WHERE USERID = 4
This query times out on our webserver but not on any other server.
If I change the NAME_USER for NAMEUSER, it works on all servers.
If I change the 4 for a 6, Times out on the web server but works on all
the other servers.
If I change the 4 for a 6 and, NAMEUSER for NUSER, it works on all
servers ...
And it goes on and on ...

No comments:

Post a Comment