<ul>
  <li>What is it?</li>
  <li>How do I implement connection pooling with MS SQL?</li>
  <li>What are the performance ramifications when</li>
    <ul>
      <li>Executing many queries one-after-the other (i.e. using a loop with 30K+ iterations calling a stored procedure)?</li>
      <li>Executing a few queries that take a long time (10+ min)?</li>
    </ul>
  <li>Are there any best practices?</li>
</ul>

[{'answer_id': 9233, 'author': 'Keith', 'author_id': 905, 'author_profile': 'https://Stackoverflow.com/users/905', 'pm_score': 3, 'selected': True, 'text': "<p>Connection pooling is a mechanism to re-use connections, as establishing a new connection is slow.</p>\n\n<p>If you use an MSSQL connection string and System.Data.SqlClient then you're already using it - in .Net this stuff is under the hood most of the time.</p>\n\n<p>A loop of 30k iterations might be better as a server side cursor (look up T-SQL cursor statements), depending on what you're doing with each step outside of the sproc.</p>\n\n<p>Long queries are fine - but be careful calling them from web pages as Asp.Net isn't really optimised for long waits and some connections will cut out. </p>\n"}, {'answer_id': 9241, 'author': 'Jeff Donnici', 'author_id': 821, 'author_profile': 'https://Stackoverflow.com/users/821', 'pm_score': 2, 'selected': False, 'text': '<p>A little more info on the connection pooling thing... you\'re using it already with SqlClient, but only if your connection string is identical for each new connection you open. My understanding is that the framework will pool connections automatically when it can, but if the connection string varies even slightly from one connection to the next, then the new connection won\'t come from the pool - it gets created anew (so it\'s more expensive).</p>\n\n<p>You can use the Performance Monitor app with XP/Vista to watch SQL connections and you\'ll see pretty quickly whether or not pooling is being used. Look under the ".NET CLR Data" category" in Performance Monitor.</p>\n'}, {'answer_id': 9247, 'author': 'Stu', 'author_id': 414, 'author_profile': 'https://Stackoverflow.com/users/414', 'pm_score': 0, 'selected': False, 'text': "<p>I second Keith; if you're calling a stored procedure 30,000 times, you have far bigger problems than connection pooling.</p>\n"}, {'answer_id': 9263, 'author': 'Rob Cooper', 'author_id': 832, 'author_profile': 'https://Stackoverflow.com/users/832', 'pm_score': -1, 'selected': False, 'text': '<p>Your question was also partially answered by <a href="https://stackoverflow.com/questions/8223/connection-pooling-in-netmssql">this thread</a>. A search would have revealed this.. The definition of Connection Pooling, of which a <a href="http://www.google.com/search?q=connection+pooling" rel="nofollow noreferrer">Google</a> would have answered with the first hit being <a href="http://en.wikipedia.org/wiki/Connection_pool" rel="nofollow noreferrer">this</a>..</p>\n\n<p>Which would leave just the best practices, which I think would have been a good question :)</p>\n\n<p>+1 to <a href="https://stackoverflow.com/questions/9228/adonet-connection-pooling-ms-sql#9233">Keith\'s Answer</a>. He has hit the nail right on the head.</p>\n\n<p>Just a polite reminder from the FAQ:</p>\n\n<blockquote>\n  <p>You\'ve searched the internet before\n  asking your question, and you come to\n  us armed with research and information\n  about your question ... right?</p>\n</blockquote>\n'}]
['https://Stackoverflow.com/questions/9228', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/357/']