Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 4E6141337B97 for ; Wed, 23 Feb 2011 13:31:32 -0400 (AST) 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 82527-09 for ; Wed, 23 Feb 2011 17:31:23 +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 00233133740B for ; Wed, 23 Feb 2011 13:31:22 -0400 (AST) 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 p1NHVKIg002317; Wed, 23 Feb 2011 12:31:20 -0500 (EST) To: Robert Haas cc: Noah Misch , Nikolas Everett , pgsql-performance@postgresql.org Subject: Re: Exhaustive list of what takes what locks In-reply-to: References: <20110202052004.GA26098@tornado.gateway.2wire.net> <20110223042108.GA27781@tornado.gateway.2wire.net> Comments: In-reply-to Robert Haas message dated "Wed, 23 Feb 2011 12:21:12 -0500" Date: Wed, 23 Feb 2011 12:31:19 -0500 Message-ID: <2316.1298482279@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: 201102/454 X-Sequence-Number: 42592 Robert Haas writes: > ...but that begs the question of why DROP INDEX needs an > AccessExclusiveLock. It probably needs such a lock *on the index* but > I don't see why we'd need it on the table. Some other session might be in process of planning a query on the table. It would be sad if the index it had chosen turned out to have vanished meanwhile. You could perhaps confine DROP INDEX's ex-lock to the index, but only at the price of making the planner take out a lock on every index it considers even transiently. Which isn't going to be a net improvement. (While we're on the subject, I have strong suspicions that most of what Simon did this cycle on ALTER TABLE lock strength reduction is hopelessly broken and will have to be reverted. It's on my to-do list to try to break that patch during beta, and I expect to succeed.) regards, tom lane