title: asyncpg - connection vs connection pool
body: <p>I am going over <a href="https://magicstack.github.io/asyncpg/current/api/index.html" rel="noreferrer"><code>asyncpg</code></a>'s documentation, and I am having trouble understanding why use a connection pool instead of a single connection.</p>
  
  <p>In the <a href="https://magicstack.github.io/asyncpg/current/examples.html" rel="noreferrer">example given</a>, a pool is used:</p>
  
  <pre><code>async with pool.acquire() as connection:
      async with connection.transaction():
          result = await connection.fetchval('select 2 ^ $1', power)
          return web.Response(
              text="2 ^ {} is {}".format(power, result))
  </code></pre>
  
  <p>but it could also be done by creating a connection when necessary:</p>
  
  <pre><code>connection = await asyncpg.connect(user='postgres')
  async with connection.transaction():
      result = await connection.fetchval('select 2 ^ $1', power)
      return web.Response(
              text="2 ^ {} is {}".format(power, result))
  </code></pre>
  
  <p>What's the advantage of using pools over connections as necessary?</p>