Ich gehe über asyncpg
's Dokumentation, und ich habe Probleme zu verstehen, warum ein Verbindungspool statt einer einzelnen Verbindung verwenden.asyncpg - Verbindung vs Verbindung Pool
Im example given wird ein Pool verwendet:
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))
aber auch durch die Schaffung einer Verbindung durchgeführt werden konnte, wenn nötig:
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))
Was ist der Vorteil von Pools über Verbindungen nach Bedarf mit ?