Re: multiple threads inserting into the same table

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Brian Cox <brian(dot)cox(at)ca(dot)com>
Cc: "Tom Lane [tgl(at)sss(dot)pgh(dot)pa(dot)us]" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: multiple threads inserting into the same table
Date: 2009-03-23 20:38:52
Message-ID: dcc563d10903231338y38879310j438eb07b64593c42@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Mar 23, 2009 at 2:25 PM, Brian Cox <brian(dot)cox(at)ca(dot)com> wrote:
> Tom Lane [tgl(at)sss(dot)pgh(dot)pa(dot)us] wrote:
>>
>> pg_stat_activity says those five threads are doing nothing except
>> sitting around with open transactions.  You sure you don't have a bug on
>> the application side?
>>
>>                        regards, tom lane
>
> This is a java app. A thread dump reveals that these 5 threads are all
> asleep on a socket read to postgres (see below). DbUtils.java:2265 is:
>
> session.connection().createStatement() .executeUpdate(((DatabaseInsert)
> insertObject).getInsertStmt(session));
>
> This generates and executes a single SQL insert. Since, as you point out,
> postgres seems to think that this transaction isn't doing anything,
> it's hard to figure out what the read is doing.

Might you have a firewall that's killing the connections? What does
netstat -an on the client side say about these connections?

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Brian Cox 2009-03-23 20:52:06 Re: multiple threads inserting into the same table
Previous Message Brian Cox 2009-03-23 20:25:52 Re: multiple threads inserting into the same table