Re: COPY (query) TO file - Mailing list pgsql-hackers

From Greg Stark
Subject Re: COPY (query) TO file
Date
Msg-id 87ejy7dyda.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: COPY (query) TO file  (Tino Wildenhain <tino@wildenhain.de>)
Responses Re: COPY (query) TO file  (PFC <lists@peufeu.com>)
List pgsql-hackers
Tino Wildenhain <tino@wildenhain.de> writes:

> Tom Lane wrote:
> > Tino Wildenhain <tino@wildenhain.de> writes:
> >> Ok, but why not just implement this into pg_dump or psql?
> >> Why bother the backend with that functionality?
> > 
> > You're not seriously suggesting we reimplement evaluation of WHERE clauses
> > on the client side, are you?

No, he's suggesting the client implement COPY formatting after fetching a
regular result set.

Of course this runs into the same problem other clients have dealing with
large result sets. libpq doesn't want to let the client deal with partial
results so you have to buffer up the entire result set in memory.

I was also vaguely pondering whether all the DDL commands could be generalized
to receive or send COPY formatted data for repeated execution. It would be
neat to be able to prepare an UPDATE with placeholders and stream data in COPY
format as parameters to the UPDATE to execute it thousands or millions of
times without any protocol overhead or network pipeline stalls.

-- 
greg



pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: More thoughts about planner's cost estimates
Next
From: Josh Berkus
Date:
Subject: Re: More thoughts about planner's cost estimates