Historical key
npm install pg-pool@npm:@stackline/pg-poolExisting require('pg-pool') calls continue unchanged.
PostgreSQL connection pool / MIT
A maintained, dependency-free continuation of [email protected] for long-lived PostgreSQL connection pooling.
npm install @stackline/pg-pool
Keep existing imports with npm install pg-pool@npm:@stackline/pg-pool.
01 / Quick start
const Pool = require('@stackline/pg-pool')
const { Client } = require('@stackline/pg')
const pool = new Pool({ Client, max: 20 })
const result = await pool.query('select now()')
await pool.end()02 / Pool lifecycle
Long-lived pools. Create one pool for an application process and reuse it. Size, idle, connection, lifetime, and maximum-use limits remain configurable.
Transactions. Check out one client for the complete transaction and release it in a finally block.
Shutdown. pool.end() drains idle resources and preserves the callback and promise forms of the upstream API.
03 / Dependency boundary
pg peer dependency@stackline/pg04 / Migration
05 / Reference