3 ms·
I wish the author explained the difference between pipelines and multi-statement queries
by chris_pie 1y ago
I wish the author explained the difference between pipelines and multi-statement queries
- gurjeet 1y agoAuthor did a good job demonstrating query pipelining. For multi-statement queries, one can read about them in the Postgres docs here: https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT https://www.postgresql.org/docs/current/protocol-flow.html#P...
- namibj 1y agoThere are no multi-statement queries in the binary protocol (where you get things like native cursors/pagination to efficiently iterate over result rows, and where you get the true parameter binding that is inherently robust against SQL injection. It has a separate client to server packet that forces previous ones to complete as it will make otherwise-asynchronous (because pipelining) error reporting forcefully serial. Other than this which is arguably not needed for queries that don't expect errors enough to need early/eager exception throwing during the course of a transaction, it's inherently naturally pipelined as you can just fire two or more statements worth of parameter binding and result fetching back-to-back without blocking on anything.