Re: Producer/Consumer Issues in the COPY across network

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Producer/Consumer Issues in the COPY across network
Date: 2008-02-28 14:39:53
Message-ID: 20080228143953.GA27658@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 28, 2008 at 01:57:49AM +0000, Simon Riggs wrote:
> >
> > AIUI the server merely streams the rows to you, the client doesn't get
> > to say how many :)
>
> Right, but presumably we generate a new message per PQgetCopyData()
> request? So my presumption is we need to wait for that to be generated
> each time?

No, PQgetCopyData() doesn't send anything. It merely reads what's in
the kernel socket buffer to a local buffer and when it has a complete
line it mallocs a string and returns it to you.

Similarly, PQputCopyData() doesn't expect anything from the server
during transmission.

That's why I was wondering about the rows per packet. Sending bigger
packets reduces overall overhead.

(The malloc/free per row doesn't seem too efficient.)

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2008-02-28 16:58:01 Re: UUID data format 4x-4x-4x-4x-4x-4x-4x-4x
Previous Message Andrew Dunstan 2008-02-28 14:21:04 Re: Silly Newbie question