pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kelly Burkhart <kelly@kkcsm.net>
To: Steve Eckmann <eckmann@computer.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: improving write performance for logging application
Date: Wed, 4 Jan 2006 09:40:31 -0600
Message-ID: <fa1e4ce70601040740t7f20ac13w9fddc80c10921c6@mail.gmail.com> (raw)
In-Reply-To: <43BBD6E2.6080300@computer.org>
References: <43BB0C5C.8020207@computer.org>
	<20060104000603.GA29469@uio.no>
	<43BBD6E2.6080300@computer.org>

On 1/4/06, Steve Eckmann <eckmann@computer.org> wrote:
>
> Thanks, Steinar. I don't think we would really run with fsync off, but I
> need to document the performance tradeoffs. You're right that my explanation
> was confusing; probably because I'm confused about how to use COPY! I could
> batch multiple INSERTS using COPY statements, I just don't see how to do it
> without adding another process to read from STDIN, since the application
> that is currently the database client is constructing rows on the fly. I
> would need to get those rows into some process's STDIN stream or into a
> server-side file before COPY could be used, right?


Steve,

You can use copy without resorting to another process.  See the libpq
documentation for 'Functions Associated with the copy Command".  We do
something like this:

char *mbuf;

// allocate space and fill mbuf with appropriately formatted data somehow

PQexec( conn, "begin" );
PQexec( conn, "copy mytable from stdin" );
PQputCopyData( conn, mbuf, strlen(mbuf) );
PQputCopyEnd( conn, NULL );
PQexec( conn, "commit" );

-K

view thread (13+ messages)  latest in thread

Message-ID: <fa1e4ce70601040740t7f20ac13w9fddc80c10921c6@mail.gmail.com>
Permalink:  ../fa1e4ce70601040740t7f20ac13w9fddc80c10921c6@mail.gmail.com/
Also on:    postgresql.org/message-id/fa1e4ce70601040740t7f20ac13w9fddc80c10921c6@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: kelly@kkcsm.net, eckmann@computer.org
  Subject: Re: improving write performance for logging application
  In-Reply-To: <fa1e4ce70601040740t7f20ac13w9fddc80c10921c6@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox