Currently, each pool.query() call acquires a connection, sends one query, waits for the response, then releases the connection. When many queries are pending, they are processed one at a time per connection, resulting in one TCP round trip per query.
Libraries like postgres.js achieve higher throughput by automatically batching multiple pending queries into a single TCP write (implicit pipelining).
Currently, each pool.query() call acquires a connection, sends one query, waits for the response, then releases the connection. When many queries are pending, they are processed one at a time per connection, resulting in one TCP round trip per query.
Libraries like postgres.js achieve higher throughput by automatically batching multiple pending queries into a single TCP write (implicit pipelining).