X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 75D009FA176 for ; Thu, 25 May 2006 04:27:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 25807-04 for ; Thu, 25 May 2006 04:27:20 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 4946E9F9F8F for ; Thu, 25 May 2006 04:27:20 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id k4P7R8hB015745 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 25 May 2006 01:27:12 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.6/8.13.6) with ESMTP id k4P7R7dR031996; Thu, 25 May 2006 01:27:07 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.6/8.13.6/Submit) id k4P7R7aO031995; Thu, 25 May 2006 01:27:07 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 25 May 2006 01:27:07 -0600 From: Michael Fuhr To: Sriram Dandapani Cc: pgsql-admin@postgresql.org Subject: Re: determining which operation is blocking another query Message-ID: <20060525072707.GA31892@winnie.fuhr.org> References: <6992E470F12A444BB787B5C937B9D4DF04997303@ca-mail1.cis.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF04997303@ca-mail1.cis.local> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/349 X-Sequence-Number: 21881 On Wed, May 24, 2006 at 11:49:37PM -0700, Sriram Dandapani wrote: > Is there a system view that can be used to determine which > INSERT/UPDATE/DELETE/Other Operation is blocking a SELECT statement. Query pg_locks to see what locks transactions have acquired or are waiting to acquire. If you have stats_command_string enabled then querying pg_stat_activity should show sessions' current queries. Are you sure SELECT is blocked, or could it just be taking a long time? MVCC allows SELECT to run concurrently with INSERT, UPDATE, and DELETE without blocking; only a few operations like VACUUM FULL block an ordinary SELECT (without FOR SHARE or FOR UPDATE). -- Michael Fuhr