On 29/07/13 7:08 PM, Sven Van Caekenberghe wrote:

The explanation for the slowdown must be in the PgV2 driver.

The PgV2 protocol is described at:
  http://www.postgresql.org/docs/7.1/static/protocol-message-formats.html

Have a glance at the "AsciiRow" and "BinaryRow" message formats. The driver reads the data off the socket, parsing the the data, as described as described by the message format. With the V2 protocol design, you have to read the result row, one field at a time.

IIUC, in the newer V3? protocol, the AsciiRow/BinaryRow message is replaced by a DataRow message. The DataRow message has the message size included, which could allow the driver to read the entire set of fields for one data row, using a single socket read (or a few buffer sized reads).

I recall seeing an experimental V3 protocol implementation, a few years back - sorry, no links handy. It would be nice to see some benchmarks.

Hope that helps.

Reply via email to