Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 1C1EB633D6F for ; Mon, 23 Mar 2009 17:39:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 18983-06 for ; Mon, 23 Mar 2009 17:38:52 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.29]) by mail.postgresql.org (Postfix) with ESMTP id EDDA0633ABC for ; Mon, 23 Mar 2009 17:38:54 -0300 (ADT) Received: by yx-out-2324.google.com with SMTP id 8so1486020yxm.73 for ; Mon, 23 Mar 2009 13:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=PC5DXWaLGwnnt0vZBMYpRPsPg9BE2EPDS/6O2ksH6AQ=; b=ej9pixg5qSMgPdVT9G+NzZmtSnSQa827Wo9i353D8CYhnAcnLHxTP3TvxzTlL9FRte DOub/tSxi/+kAGSBzd/5WqOAJYU66WkFpZvgEf1q+P3+n9jQ+7PMVfrXvNmKI++Ojsj0 Aj3s1U5y2hj6mtAY8AvqCMGN3HrjDIGmuxeWg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=bmRYlvRmRlO2kaUWoK0sY3UhIe1U7iDoayS9UojH4d1ZcuKwezUW642HYLJDWuidKa iiQ1AbGgowG86vU5Nurll4wqCDTfKiFCw9u5BgjFgFjF2JX4UzcApiQXYetb63q924c3 zFDiddTm7F8o/JXeBrRovHNu6mibZd6YPKgPU= MIME-Version: 1.0 Received: by 10.100.58.19 with SMTP id g19mr4621874ana.101.1237840732076; Mon, 23 Mar 2009 13:38:52 -0700 (PDT) In-Reply-To: <49C7F050.7030505@ca.com> References: <49C7F050.7030505@ca.com> Date: Mon, 23 Mar 2009 14:38:52 -0600 Message-ID: Subject: Re: multiple threads inserting into the same table From: Scott Marlowe To: Brian Cox Cc: "Tom Lane [tgl@sss.pgh.pa.us]" , "pgsql-performance@postgresql.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/336 X-Sequence-Number: 33258 On Mon, Mar 23, 2009 at 2:25 PM, Brian Cox wrote: > Tom Lane [tgl@sss.pgh.pa.us] wrote: >> >> pg_stat_activity says those five threads are doing nothing except >> sitting around with open transactions. =A0You sure you don't have a bug = on >> the application side? >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0regards, 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?