title: Microsoft CRM 2011: SQL timeout expired on Adv Find
body: <p>I have an on-premise instance of MS CRM 2011. Many advanced finds have just hit the point of "SQL Server timeout expired." They aren't crazy ones either. CRM Trace doesn't give me much info beyond the same thing as the event viewer (shown at the bottom of this post). I have tried SQL traces using the directions <a href="http://blogs.msdn.com/b/emeadcrmsupport/archive/2011/03/01/create-a-crm-profiler-template-and-trace-for-crm-issues.aspx" rel="nofollow">here</a> and <a href="http://blogs.msdn.com/b/crm/archive/2009/12/03/capturing-and-analysing-sql-queries-in-crm-implementations.aspx" rel="nofollow">here</a>, but there is simply too much going on in SQL to decipher it. Any ideas what exactly I should be looking for?</p>
  
  <p>I have been tweaking performance on this for years, so I have already tried a lot of the common tricks (OLEDBTimeout/ExtendedTimeout, adding indexes, etc.)</p>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Exception information: 
        Exception type: CrmException 
        Exception message: SQL timeout expired.
       at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
       at Microsoft.Crm.Application.Platform.ServiceCommands.RetrieveMultipleCommand.Execute()
       at Microsoft.Crm.ApplicationQuery.RetrieveMultipleCommand.RetrieveData()
       at Microsoft.Crm.ApplicationQuery.ExecuteQuery()
       at Microsoft.Crm.Application.Platform.Grid.GridDataProviderQueryBuilder.GetData(QueryBuilder queryBuilder)
       at Microsoft.Crm.Application.Platform.Grid.GridDataProviderQueryBuilder.LoadQueryData()
       at Microsoft.Crm.Application.Platform.Grid.GridDataProviderQueryBuilder.LoadData()
       at Microsoft.Crm.Application.Controls.GridUIProvider.PrepareGridData()
       at Microsoft.Crm.Application.Controls.GridUIProvider.Render(HtmlTextWriter output)</p>
    
    <p>... abridged ...</p>
    
    <p>at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</p>
    
    <p>Request information: 
        Request URL: url/org/AdvancedFind/fetchData.aspx?EntityCode=10210&amp;QueryId={029DE247-EE5F-4FF9-B2E2-2730CFB17B0F}&amp;ViewType=1039&amp;pagemode=iframe&amp;sitemappath=sales|Customers234|contact 
        Request path: /org/AdvancedFind/fetchData.aspx 
        User host address: 1.2.3.4
        User: domain\username
        Is authenticated: True 
        Authentication Type: Negotiate 
        Thread account name: domain\SQL_ADMIN </p>
  </blockquote>