본문으로 건너뛰기
cccskills
무료GitHub에 공개

database-connection-pool-manager

PgBouncer, connection optimization, and pooling strategies for database performance. Activate on: connection pool, PgBouncer, database connections, pool size, connection limit, Prisma pool, Drizzle pool. NOT for: query optimization (use data-warehouse-optimizer), database schema design (use dimensional-modeler).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구SupabasePostgreSQL
설치 방법 보기

포함된 파일(1)

  • SKILL.md4.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Database Connection Pool Manager

Optimize database connection pools for throughput, latency, and resource efficiency using PgBouncer, application-level poolers, and cloud-managed pools.

Activation Triggers

Activate on: "connection pool", "PgBouncer", "database connections", "pool size", "connection limit", "too many connections", "connection timeout", "Prisma pool", "Supabase pooler"

NOT for: SQL query optimization → data-warehouse-optimizer | Schema design → dimensional-modeler | ORM selection → api-architect

Quick Start

  1. Audit current connections — SELECT count(*) FROM pg_stat_activity to understand baseline
  2. Choose pooling mode — transaction pooling (default), session pooling (for prepared statements)
  3. Size the pool — start with connections = (cores * 2) + spindle_count per PostgreSQL docs
  4. Deploy pooler — PgBouncer sidecar or Supabase/Neon built-in pooler
  5. Monitor — track active/idle/waiting connections, query queue time

Core Capabilities

DomainTechnologies
External PoolersPgBouncer 1.23+, Odyssey, PgCat
Cloud PoolersSupabase Supavisor, Neon pooler, RDS Proxy
App-LevelPrisma connection pool, Drizzle pool, node-postgres Pool
Monitoringpg_stat_activity, PgBouncer SHOW commands, Prometheus
DatabasesPostgreSQL 16+, MySQL 8.4+, CockroachDB

Architecture Patterns

PgBouncer Transaction Pooling

App Instances (100 connections)
    ↓
PgBouncer (pool_mode = transaction)
    max_client_conn = 200
    default_pool_size = 20
    reserve_pool_size = 5
    ↓
PostgreSQL (max_connections = 30)

Key: 200 app connections share 20 actual database connections. Each connection is released back to the pool at transaction end.

Pool Sizing Formula

Optimal pool size = ((core_count * 2) + effective_spindle_count)

Example (8-core server, SSD):
  pool_size = (8 * 2) + 1 = 17

For serverless (many short-lived functions):
  pgbouncer.default_pool_size = 20
  pgbouncer.min_pool_size = 5
  app.max_pool_size = 5  (per function instance)
  total_functions * 5 <= pgbouncer.max_client_conn

Prisma with PgBouncer

// schema.prisma — pgbouncer mode disables prepared statements
datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")        // pooler:6543/db?pgbouncer=true
  directUrl = env("DIRECT_DATABASE_URL") // direct:5432/db (for migrations)
}

// Connection limit per Prisma instance
generator client {
  provider = "prisma-client-js"
}

// At runtime
const prisma = new PrismaClient({
  datasources: {
    db: { url: process.env.DATABASE_URL },
  },
  // connection_limit set via URL param: ?connection_limit=5
});

Anti-Patterns

  1. One connection per request — never open/close connections per HTTP request; use a pool
  2. Oversized pools — more connections != more throughput; past the optimal size, context switching kills performance
  3. Session pooling by default — use transaction pooling unless you need prepared statements or session variables
  4. No connection timeout — always set idle_timeout and server_idle_timeout to reclaim stale connections
  5. Ignoring pool exhaustion — monitor cl_waiting in PgBouncer; if clients wait, pool is undersized or queries are too slow

Quality Checklist

  • Pool size calculated based on CPU cores, not arbitrary numbers
  • PgBouncer or equivalent deployed for serverless/high-connection workloads
  • Transaction pooling mode used (session pooling only when required)
  • idle_timeout set to reclaim unused connections (default: 300s)
  • Application connection_limit per instance is <= pool_size / instance_count
  • Migrations run on direct connection, not through pooler
  • Connection pool metrics exported (active, idle, waiting, total)
  • Alert configured for pool exhaustion (waiting > 0 for > 10s)
  • Prepared statements disabled when using transaction pooling
  • Load tested: pool handles 2x expected concurrent connections

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Expert in 2000s-era music visualization (Milkdrop, AVS, Geiss) and modern WebGL implementations. Specializes in Butterchurn integration, Web Audio API AnalyserNode FFT data, GLSL shaders for audio-reactive visuals, and psychedelic generative art. Activate on "Milkdrop", "music visualization", "WebGL visualizer", "Butterchurn", "audio reactive", "FFT visualization", "spectrum analyzer". NOT for simple bar charts/waveforms (use basic canvas), video editing, or non-audio visuals.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

curiositech/port-daddy32026년 10월 18일 업데이트

Expert legal research agent for finding and scraping expungement data state by state. Knows authoritative sources, URL patterns, Firecrawl configuration, and 2026 legal landscape.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

curiositech/port-daddy32026년 10월 18일 업데이트

Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

curiositech/port-daddy32026년 10월 18일 업데이트

Apply crisis decision-making research to agent routing, uncertainty triage, and coordination failure analysis in time-pressured systems. Use when diagnosing handoff failures, analytical paralysis, or expert judgment under incomplete information. NOT for routine coding, simple CRUD design, or static single-agent tasks with complete information.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

curiositech/port-daddy32026년 10월 18일 업데이트

Use for insight, reframing, contradiction, impasse, and anomaly-driven problem solving when execution effort no longer helps. NOT for routine optimization, error correction, or well-specified tasks with known solution paths.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

curiositech/port-daddy32026년 10월 18일 업데이트

Apply cognitive task analysis to expert work that depends on perceptual cues, branching judgment, and recurring monitoring loops. Use when decomposing expert capability into agent structure, simulation design, or validation interviews. NOT for ordinary step-by-step SOP capture or simple pipelines with no tacit cue layer.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

curiositech/port-daddy32026년 10월 18일 업데이트

curiositech의 스킬 모두 보기

이 스킬의 문제 신고