Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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>
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

In response to


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group