Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SORT_INIT causing timeout issues
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

23 Posts

Posted - 04/27/2011 :  11:51:37  Show Profile  Reply with Quote

We have two pretty complex queries that involve sorting/ordering. Will provide details if required. We were running into timeout issues on these queries. While we do have opportunities to improve them, the interesting part was, in the trace events that we captured to investigate the issue, We notice in the SQL Trace that once the query begins, I see a SQL Transaction event with ObjectName as either GarbageCollection or GhostCleanupTask. This continues for about 30 seconds when the query times out due to the default timeout of the Command object.

The sequence of events is:

SP Statement Starting : Complex query
SQL Transaction: sort_init
SQL Transaction: TVQuery
SQL Transaction: GarbageCollection (We use filestream feature)
SQL Transaction: GhostCleanupTask

Can anyone explain why, for a very complex query, the sort_init would kick in the GC and GCTask ?

Appreciate any help...

Shishir Khandekar

Starting Member

23 Posts

Posted - 04/27/2011 :  16:28:55  Show Profile  Reply with Quote
One thing that I forgot to mention was that this happens only when this stored procedure is called from the application tier (.net) and not thru SSMS. We use SQL 2008 R2 RTM, Express Edition.
Go to Top of Page

Starting Member

1 Posts

Posted - 09/04/2013 :  23:06:19  Show Profile  Reply with Quote
I have same problem now, and want to know how did you solve it? thanks.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000