Queries hang on some databases

  • I am using C# and Telerik reports. For client my report hang up for some table and shows Network error while this query runs correctly in T-SQL and fetch data in milliseconds. After running query in T-Sql , report also runs correctly and application fetch data. Previously this issue occur and i deattach and reattach client database and that solve my problem but now it does not work.

    Can anyone tell me what can be the cause and how this problem may be solved.

  • Take a look in the Activity Monitor in SSMS on the SQL Server at the moment the clients query seems to hang. Look at all the processes/queries that are executed against the database and look for the wait resources and/or blocking processes.

    Detaching and attaching the database should not be the solution. When this work-around solves your problem it is probably because your query is being blocked. Detaching and attaching the database effectively kills all connections to the database, after which your query can be started again. You should however investigate which other process is blocking your query en subsequently investigate why that other process keeps on running or is running too long or runs at that particular moment.

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • All you did by detaching the database was flush queries out of the cache (and probably flushed data out of the cache too). That's not a solution. Instead, you need to set up monitoring on your server in order to understand where the bottlenecks are coming from. Then, usually, you have to look at the code of the queries to see what's going wrong. All these topics are covered in the books in my signature below. With such a generic question, that's all the information I can suggest.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply