Thread: Multi-line requests in COPY ... FROM STDIN

Multi-line requests in COPY ... FROM STDIN

From
Mischa
Date:
I'm using a 7.4.6 Perl app that bulk-loads a table,
by executing a "COPY TMP_Message FROM STDIN", then letting
$dbh->func($message_text."\n", "putline")

Speculation made me try catenating Several \n-terminated lines
together, and making a single putline() call with that.
Lo and behold, all the lines went in as separate rows, as I hoped.

I haven't measured the performance difference using this multiline
batching. I'm hoping that there will be as much,since the app is really sucking
on a 500 msg/sec firehose, and the db side needs serious speeding up. Question
is, am I  playing with a version-dependent anomaly, or should I expect this
to continue in 8.x (until, eventually, silently, something causes
this to break)?

I'm presuming that this is not a Perl DBI/DBD::Pg question,
but rather, depending on the underlying pq lib and fe protocol.

--
"Dreams come true, not free."