title: Do I need a maintenance plan to prevent a known SQL Server timeout from happening in the future?
body: <p>We have a query in our C# / LINQ to EF code which consistently caused a timeout when run through our web application (ASP.NET MVC).</p>
  
  <p>Error message: </p>
  
  <blockquote>
    <p>Execution Timeout Expired.<br>
    The timeout period elapsed prior to completion of the operation or the server is not responding.</p>
  </blockquote>
  
  <p>Running the SQL generated by LINQ directly in SSMS was almost instantaneous, regardless of the size of data returned or queried (we're using date ranges in the query).</p>
  
  <p><a href="https://stackoverflow.com/a/8603111/660223">This answer</a> solved the timeout issue: we ran </p>
  
  <pre><code>exec sp_updatestats 
  </code></pre>
  
  <p>on the db and <strong>now the timeout no longer occurs</strong>.</p>
  
  <p>However, as was mentioned in the comments, does this solve the actual problem? </p>
  
  <p>Does it prevent the problem from happening in the future?</p>
  
  <ol>
  <li><p>Since the query didn't cause any issues running directly in SSMS, does this indicate a problem with ASP.NET / EF? </p></li>
  <li><p>Or is a maintenance plan the correct approach? I don't know anything about maintenance plans. I see questions <a href="https://stackoverflow.com/questions/2275516/how-often-should-the-indexes-be-rebuilt-in-our-sql-server-database">about rebuilding indices</a>, backups etc. If I need a maintenance plan to prevent this timeout issue from occurring in the future, what type of plan must I set up?</p></li>
  </ol>