Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMehK-0004OG-Qx for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Jul 2016 17:08:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bMehJ-00084V-QI for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Jul 2016 17:08:45 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bMehH-00083v-PU for pgsql-bugs@postgresql.org; Mon, 11 Jul 2016 17:08:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bMehF-0000Np-5n for pgsql-bugs@postgresql.org; Mon, 11 Jul 2016 17:08:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u6BH8eBT024590; Mon, 11 Jul 2016 13:08:40 -0400 From: Tom Lane To: David Waller cc: "pgsql-bugs@postgresql.org" Subject: Re: BUG #14237: Terrible performance after accidentally running 'drop index' for index still being created In-reply-to: <6A9A127D-FE6F-422D-BE82-B8154757367F@microsoft.com> References: <20160708102407.1409.87848@wrigleys.postgresql.org> <11675.1467990502@sss.pgh.pa.us> <6A9A127D-FE6F-422D-BE82-B8154757367F@microsoft.com> Comments: In-reply-to David Waller message dated "Mon, 11 Jul 2016 16:42:27 -0000" Date: Mon, 11 Jul 2016 13:08:40 -0400 Message-ID: <24589.1468256920@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org David Waller writes: > Thank you for the detailed explanation. This all seems very sensible, and > reasonable behaviour from Postgres. Yet... it still 'allowed' me to shoot myself > painfully in the foot. User error, I agree, yet people make mistakes - could > Postgres behave more gracefully? Well, there are always tradeoffs. You could choose to run with a non-infinite setting of lock_timeout, which would have caused the DROP to fail after waiting a second or two (or whatever you set the timeout to be). That would move the denial of service over to the problematic DDL, which might be a good tradeoff for your environment. But not everybody is going to think that query failure is a "more graceful" solution. > For example, would it be at all feasible for Postgres to handle DDL statements > differently from regular requests? In this example it was pointless for DROP > INDEX to take any locks while there was already another DDL statement (CREATE > INDEX) running. Could it have been added to a queue of DDL statements against > that table and not attempted to take a lock until CREATE INDEX completed and > DROP INDEX then reached the head of the queue? This is handwaving: the DROP already was in a lock queue. I really doubt there are any easy fixes that won't create as many problems as they solve. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs