Re: Postgres refusing to use >1 core - Mailing list pgsql-performance

From Merlin Moncure
Subject Re: Postgres refusing to use >1 core
Date
Msg-id BANLkTik3Yrg9O_0Sjxae5=556nROrfq0hg@mail.gmail.com
Whole thread Raw
In response to Re: Postgres refusing to use >1 core  (Aren Cambre <aren@arencambre.com>)
Responses Re: Postgres refusing to use >1 core
List pgsql-performance
On Mon, May 9, 2011 at 4:50 PM, Aren Cambre <aren@arencambre.com> wrote:
>> Are you sure you are really using > 1 connection?  While your test is
>> running, log onto postgres with psql and grab the output of
>> pg_stat_activity a few times.  What do you see?
>
> Thanks. If a connection corresponds to a process, then this suggests I am
> using 1 connection for my main thread, and all the threads it spawns are
> sharing another connection.

Yes.  However I can tell you with absolute certainly that postgres
will distribute work across cores.  Actually the o/s does it -- each
unique connection spawns a single threaded process on the backend.  As
long as your o/s of choice is supports using more than once process at
once, your work will distribute.  So, given that, your problem is:

*) your code is actually using only one connection
*) you have contention on the server side (say, a transaction
outstanding that it blocking everyone)
*) you have contention on the client side -- a lock in your code or
inside npgsql
*) your measuring is not correct.

so follow the advice above. we need to see pg_stat_activity, and/or
pg_locks while your test is running (especially take note of pg_lock
records with granted=f)

merlin

pgsql-performance by date:

Previous
From: Aren Cambre
Date:
Subject: Re: Postgres refusing to use >1 core
Next
From: "Kevin Grittner"
Date:
Subject: Re: Postgres refusing to use >1 core