You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+93Lines changed: 93 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -310,6 +310,99 @@ Issues a request to cancel the currently executing query _on this instance of li
310
310
311
311
Returns the version of the connected PostgreSQL backend server as a number.
312
312
313
+
### Pipeline Mode (PostgreSQL 14+)
314
+
315
+
Pipeline mode allows sending multiple queries to the server without waiting for results, significantly reducing round-trip latency. These functions are only available when compiled against PostgreSQL 14 or later client libraries.
316
+
317
+
##### `pq.pipelineModeSupported():boolean`
318
+
319
+
Returns `true` if pipeline mode is supported (compiled against PostgreSQL 14+), `false` otherwise.
320
+
321
+
##### `pq.enterPipelineMode():boolean`
322
+
323
+
Enters pipeline mode on the connection. In pipeline mode, you can send multiple queries using the async send functions (`sendQuery`, `sendQueryParams`, etc.) without waiting for results.
324
+
325
+
Returns `true` if successful, `false` if failed. Throws an error if pipeline mode is not supported.
326
+
327
+
##### `pq.exitPipelineMode():boolean`
328
+
329
+
Exits pipeline mode. Can only be called when the pipeline is empty (all results have been processed).
330
+
331
+
Returns `true` if successful, `false` if failed.
332
+
333
+
##### `pq.pipelineStatus():int`
334
+
335
+
Returns the current pipeline status:
336
+
-`PQ.PIPELINE_OFF` (0): Not in pipeline mode
337
+
-`PQ.PIPELINE_ON` (1): In pipeline mode
338
+
-`PQ.PIPELINE_ABORTED` (2): Pipeline aborted due to error
339
+
340
+
##### `pq.pipelineSync():boolean`
341
+
342
+
Sends a synchronization point in the pipeline. The server will process all queries up to this point and send their results before processing any further queries. This is essential for error handling - if a query fails, all subsequent queries until the next sync point are skipped.
343
+
344
+
Returns `true` if successful, `false` if failed.
345
+
346
+
##### `pq.sendFlushRequest():boolean`
347
+
348
+
Sends a request for the server to flush its output buffer. Useful when you want to receive results before sending a sync.
349
+
350
+
Returns `true` if successful, `false` if failed.
351
+
352
+
#### Pipeline Mode Constants
353
+
354
+
```js
355
+
PQ.PIPELINE_OFF// 0 - Not in pipeline mode
356
+
PQ.PIPELINE_ON// 1 - In pipeline mode
357
+
PQ.PIPELINE_ABORTED// 2 - Pipeline aborted due to error
0 commit comments