Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 6B6B61338071 for ; Wed, 15 Sep 2010 16:28:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 64355-05-2 for ; Wed, 15 Sep 2010 19:28:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mail.postgresql.org (Postfix) with ESMTP id 753651337F02 for ; Wed, 15 Sep 2010 16:28:35 -0300 (ADT) Received: from [192.168.1.6] (static-71-179-240-8.bltmmd.fios.verizon.net [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MRhYD-1PONbk3gzJ-00TUcl; Wed, 15 Sep 2010 21:28:26 +0200 Message-ID: <4C911E58.6030605@2ndquadrant.com> Date: Wed, 15 Sep 2010 15:28:24 -0400 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Tobias Brox CC: Tom Lane , pgsql-performance@postgresql.org Subject: Re: locking issue on simple selects? References: <4096.1284557987@sss.pgh.pa.us> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:t4zcX3glNw2fjU8CsmIBkTtd+t+ikcLHiA05KRY5D9g 4OLe+aeWXFm95EdDFv6MstMC08zL0GKOzeStyS5keVzb94YBrS hFjGglUgVtyzxouwXHyoCA2LwZsWx6WGwSK8Y31DssmSR92CLC hrB6gx5iaYNAvw/GkuJe9luRrWFTLX6fx7uhDcTYr46rCwhNbm Py53hU6wMv5up+wv6ahZySBb1UMGoSRZfEe3IGcY7U= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201009/93 X-Sequence-Number: 40296 Tobias Brox wrote: > I thought so, we have a logging script that logs the content of > the pg_locks table, it didn't log anything interesting but it may be a > problem with the script itself. It does an inner join on > pg_locks.relation = pg_class.oid but when I check now this join seems > to remove most of the rows in the pg_locks table. Some of the waits you might be running into will be things waiting on another transaction holding a lock to finish, which are probably wiped out by this approach. There are some useful examples of lock views on the wiki: http://wiki.postgresql.org/wiki/Lock_Monitoring http://wiki.postgresql.org/wiki/Lock_dependency_information http://wiki.postgresql.org/wiki/Find_Locks And the idea you have of coverting the pg_class one to an outer join will help. The other thing you should try is toggling on log_lock_waits and possibly reducing deadlock_timeout. This will put a lot of the information you're trying to collect right into the logs. -- Greg Smith, 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services and Support www.2ndQuadrant.us Author, "PostgreSQL 9.0 High Performance" Pre-ordering at: https://www.packtpub.com/postgresql-9-0-high-performance/book