Re: How to force PostgreSQL to use multiple cores within one connection?

From: "Nikolas Everett" <nik9000(at)gmail(dot)com>
To: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
Cc: "Sergey A(dot)" <n39052(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to force PostgreSQL to use multiple cores within one connection?
Date: 2008-10-01 13:55:31
Message-ID: d4e11e980810010655q7a710386n46ebc35f6815d970@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If you happen to be using JDBC you can also get copy to work:

http://kato.iki.fi/sw/db/postgresql/jdbc/copy/

On Wed, Oct 1, 2008 at 9:24 AM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:

> On Wed, Oct 1, 2008 at 6:44 AM, Sergey A. <n39052(at)gmail(dot)com> wrote:
> > Hello.
> >
> > My application generates a large amount of inserts (~ 2000 per second)
> > using one connection to PostgreSQL. All queries are buffered in memory
> > and then the whole buffers are send to DB. But when I use two
> > connections to PostgreSQL instead of one on dual core CPU (i.e. I use
> > two processes of PostgreSQL) to insert my buffers I see that things
> > goes 1.6 times faster.
> >
> > Using several connections in my application is somewhat tricky, so I
> > want to move this problem to PostgreSQL's side. Is there any method
> > for PostgreSQL to process huge inserts coming from one connection on
> > different cores?
>
> If you are buffering inserts, you can get an easy performance boost by
> using copy as others have suggested. Another approach is to use
> mutli-row insert statement:
>
> insert into something values (1,2,3), (2,4,6), ...
>
> Using multiple cpu basically requires multiple connections. This can
> be easy or difficult depending on how you are connecting to the
> database.
>
> merlin
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sergey A. 2008-10-01 13:58:13 Re: How to force PostgreSQL to use multiple cores within one connection?
Previous Message Merlin Moncure 2008-10-01 13:24:20 Re: How to force PostgreSQL to use multiple cores within one connection?