davidcastagnetoa/skills

pgbouncer_asyncpg

Connection pooling PostgreSQL con PgBouncer y cliente async asyncpg para alto rendimiento

First seen Mar 6, 2026

Installation

$ npx skills add davidcastagnetoa/skills --skill pgbouncer_asyncpg

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from davidcastagnetoa/skills · top by installs.

npx skills add davidcastagnetoa/skills

Browse all from davidcastagnetoa/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 1
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,363 B
  • docs SUMMARY.md 114 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 5 installs

SKILL.md

pgbouncer_asyncpg

PgBouncer en modo transaction pooling reduce el coste de conexiones PostgreSQL de ~10ms a <0.1ms. asyncpg es el cliente async de PostgreSQL más rápido para Python.

When to use

Usar para todas las operaciones de base de datos del sistema. Nunca conectar directamente a PostgreSQL desde los servicios.

Instructions

  1. Instalar asyncpg: pip install asyncpg.
  2. Instalar PgBouncer: disponible en apt install pgbouncer o imagen Docker.
  3. Configurar PgBouncer en modo transaction pooling (pool_mode = transaction).
  4. Configurar pool size: maxclientconn = 1000, defaultpoolsize = 20.
  5. Crear pool de conexiones en FastAPI startup:

``python pool = await asyncpg.createpool(dsn=PGBOUNCERDSN, minsize=5, maxsize=20) ``

  1. Usar el pool en cada operación: async with pool.acquire() as conn: await conn.fetch(query).
  2. Health check: verificar que PgBouncer responde y tiene conexiones disponibles.

Notes

  • PgBouncer NO soporta prepared statements en transaction mode; usar $1, $2 placeholders nativos.
  • Patroni gestiona el failover primary/replica de PostgreSQL.
  • Alembic para migraciones: pip install alembic.