Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 3A72B1337C99 for ; Wed, 15 Sep 2010 10:43:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 19781-07 for ; Wed, 15 Sep 2010 13:43:11 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id EB15F1337DDB for ; Wed, 15 Sep 2010 10:39:47 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o8FDdlli004097; Wed, 15 Sep 2010 09:39:47 -0400 (EDT) To: Tobias Brox cc: pgsql-performance@postgresql.org Subject: Re: locking issue on simple selects? In-reply-to: References: Comments: In-reply-to Tobias Brox message dated "Wed, 15 Sep 2010 12:05:03 +0200" Date: Wed, 15 Sep 2010 09:39:47 -0400 Message-ID: <4096.1284557987@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201009/87 X-Sequence-Number: 40290 Tobias Brox writes: > Recently we've frequently encountered issues where some simple selects > (meaning, selects doing an index lookup and fetching one row) have > become stuck for several minutes. Apparently all requests on one > exact table gets stuck, all requests not related to said table are > going through without any problems. According to the pg_stat_activity > view, all queries getting stuck was read-queries (selects), no updates > or anything like that (some of the transactions were doing updates > and/or inserts though). > The obvious thought seems to be that this is a locking issue ... but > it doesn't seem so. For one thing, AFAIK locking shouldn't affect > selects, only updates? An exclusive lock will block selects too. Have you looked into pg_locks for ungranted lock requests? regards, tom lane