pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Waller <dwaller@yammer-inc.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14237: Terrible performance after accidentally running 'drop index' for index still being created
Date: Mon, 11 Jul 2016 13:08:40 -0400
Message-ID: <24589.1468256920@sss.pgh.pa.us> (raw)
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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

David Waller <dwaller@yammer-inc.com> 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



view thread (5+ messages)  latest in thread

Message-ID: <24589.1468256920@sss.pgh.pa.us>
Permalink:  ../24589.1468256920@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24589.1468256920@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dwaller@yammer-inc.com
  Subject: Re: BUG #14237: Terrible performance after accidentally running 'drop index' for index still being created
  In-Reply-To: <24589.1468256920@sss.pgh.pa.us>
  References: <20160708102407.1409.87848@wrigleys.postgresql.org> <11675.1467990502@sss.pgh.pa.us> <6A9A127D-FE6F-422D-BE82-B8154757367F@microsoft.com> <24589.1468256920@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox