Posted - 04/27/2011 : 11:51:37
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...