Re: BUG #14237: Terrible performance after accidentally running 'drop index' for index still being created

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dwaller(at)microsoft(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14237: Terrible performance after accidentally running 'drop index' for index still being created
Date: 2016-07-08 15:08:22
Message-ID: 11675.1467990502@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

dwaller(at)microsoft(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message guang-dih.lei 2016-07-08 15:17:47 BUG #14238: crate index hang
Previous Message Marco Nenciarini 2016-07-08 12:22:35 Re: [BUGS] BUG #14230: Wrong timeline returned by pg_stop_backup on a standby