Add a "row processor" API to libpq for better handling of large results.
Tom Lane <tgl@sss.pgh.pa.us>
Add a "row processor" API to libpq for better handling of large results. Traditionally libpq has collected an entire query result before passing it back to the application. That provides a simple and transactional API, but it's pretty inefficient for large result sets. This patch allows the application to process each row on-the-fly instead of accumulating the rows into the PGresult. Error recovery becomes a bit more complex, but often that tradeoff is well worth making. Kyotaro Horiguchi, reviewed by Marko Kreen and Tom Lane
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/libpq.sgml | modified | +268 −0 |
| src/interfaces/libpq/exports.txt | modified | +3 −0 |
| src/interfaces/libpq/fe-connect.c | modified | +10 −2 |
| src/interfaces/libpq/fe-exec.c | modified | +171 −6 |
| src/interfaces/libpq/fe-lobj.c | modified | +26 −14 |
| src/interfaces/libpq/fe-misc.c | modified | +26 −0 |
| src/interfaces/libpq/fe-protocol2.c | modified | +240 −85 |
| src/interfaces/libpq/fe-protocol3.c | modified | +211 −87 |
| src/interfaces/libpq/libpq-fe.h | modified | +26 −5 |
| src/interfaces/libpq/libpq-int.h | modified | +11 −3 |