Skip to content

Conversation

@cesco69
Copy link
Contributor

@cesco69 cesco69 commented Feb 4, 2026

This PR implements pipeline mode, allowing multiple queries to be sent to the PostgreSQL server without waiting for the results of previous queries. This significantly reduces network latency, especially for batch operations or high-latency connections.

Usage

const { Client, Pool } = require('pg')

// Enable pipeline mode on Client
const client = new Client({ pipelineMode: true }) 
await client.connect()

// All queries are sent immediately without waiting
const [r1, r2, r3] = await Promise.all([
  client.query('SELECT 1'),
  client.query('SELECT 2'),
  client.query('SELECT 3'),
])

// Also works with Pool
const pool = new Pool({ pipelineMode: true })

Features

  • Opt-in via configuration: Enable with pipelineMode: true (default: false)
  • Error isolation: Failed queries don't affect other queries in the pipeline
  • Transaction support: BEGIN/COMMIT/ROLLBACK work normally
  • Prepared statements: Full support, including concurrent queries with the same statement name

Restrictions

Related Issues

@cesco69 cesco69 marked this pull request as ready for review February 4, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement pipelining mode allowed by libpq 14

1 participant