Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bLXP0-0005dd-3Y for pgsql-bugs@arkaria.postgresql.org; Fri, 08 Jul 2016 15:09:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bLXOz-0006Jd-Ht for pgsql-bugs@arkaria.postgresql.org; Fri, 08 Jul 2016 15:09:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bLXOM-0005b7-AU for pgsql-bugs@postgresql.org; Fri, 08 Jul 2016 15:08:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bLXOE-0001Js-Jy for pgsql-bugs@postgresql.org; Fri, 08 Jul 2016 15:08:33 +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 u68F8M8K011676; Fri, 8 Jul 2016 11:08:22 -0400 From: Tom Lane To: dwaller@microsoft.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14237: Terrible performance after accidentally running 'drop index' for index still being created In-reply-to: <20160708102407.1409.87848@wrigleys.postgresql.org> References: <20160708102407.1409.87848@wrigleys.postgresql.org> Comments: In-reply-to dwaller@microsoft.com message dated "Fri, 08 Jul 2016 10:24:07 -0000" Date: Fri, 08 Jul 2016 11:08:22 -0400 Message-ID: <11675.1467990502@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 dwaller@microsoft.com writes: > Summary: While running ‘create index concurrently’ on a very large table, > running ‘drop index’ for the same index caused Postgres to perform terribly > badly, until the ‘create index’ server process was killed. I would expect > that the ‘drop index’ would either fail immediately, or wait, without > performance impact, until the ‘create index concurrently’ had completed. Hmm, the DROP INDEX should have blocked waiting for an exclusive lock on the table, and then other queries on the table should have queued up behind that lock request. I think the fact that they didn't just stop dead probably indicates that when the deadlock checker ran, it concluded it needed to let them jump the queue and go in front of the DROP INDEX to avoid a deadlock --- likely because the lock manager could see that the DROP was blocked by the CREATE INDEX CONCURRENTLY while the latter was waiting for the other queries to finish. So your slowdown corresponds to an extra wait of deadlock_timeout ms per query. This is not a bug, but designed behavior. > I would expect that running ‘drop index’ while that index is still being > created would either fail immediately, or wait, without performance impact, > until the ‘create index concurrently’ had completed. If the DROP's lock request is not allowed to block other incoming requests for a table lock, the DROP could face indefinite lock starvation. That is not better. Reducing deadlock_timeout to zero is not going to improve your overall performance, either. 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