agentsclimarketplace

Managing postgres connections

Skill pumarogie/claude-postgres-skills/skills/managing-postgres-connections

Use when configuring a Postgres connection pool, hitting max connection limits, seeing connection churn, or debugging connection-storm errors.From its SKILL.md

Install
npx -y skills add pumarogie/claude-postgres-skills --skill managing-postgres-connections

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.0 KB, 405 tokens by cl100k_base, as published. Nobody here has run it

Managing Postgres Connections

Overview

Postgres connections are expensive — each costs CPU and memory. They should be long-lived and pooled. High connection churn wastes resources, and connection storms trigger internal Postgres locks that produce nasty, hard-to-reproduce edge cases.

When to Use

  • Setting up how your app connects to Postgres.
  • Hitting too many connections / remaining connection slots are reserved.
  • Seeing latency spikes or lock contention under load that correlates with new connections.
  • Running many app instances against one database.

Quick Reference

OptionWhenNotes
External pooler (pgbouncer)PreferredSits in front of Postgres; one pool for all app instances
In-memory pooler (e.g. pgxpool for Go)FallbackPer-process; use when you can't run an external pooler
Open/close per requestNeverChurn burns CPU/memory and invites connection storms

Rules

  • Keep connections long-lived — acquire from a pool, return to the pool, don't reconnect per query.
  • Prefer an external pooler (pgbouncer) so all instances share one bounded set of server connections.
  • If you can't guarantee an external pooler (e.g. shipping software that runs against arbitrary customer databases), use an in-memory pooler like pgxpool as a fallback.
  • Bound the pool size — more connections is not more throughput; past a point it's pure contention.

Common Mistakes

  • Opening a fresh connection per request or per query — the storm pattern.
  • No pooler at all, with many app instances each opening connections directly — you exhaust max_connections and hit internal lock edge cases.
  • Setting the pool max very high "to be safe" — large connection counts increase lock contention inside Postgres rather than helping.

What ships with it: 1 file

3.4 KB alongside SKILL.md

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.