pg.ddx.io pgsql-general@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Deadlock while doing VACUUM and DROP 2+ messages / 2 participants [nested] [flat]
* Deadlock while doing VACUUM and DROP @ 2018-10-24 13:53 Michal Merta <michal.merta@greycortex.com> 2018-10-24 14:02 ` Re: Deadlock while doing VACUUM and DROP Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 2+ messages in thread From: Michal Merta @ 2018-10-24 13:53 UTC (permalink / raw) To: pgsql-general@lists.postgresql.org Hello everyone, I encountered deadlock during DROP TABLE statement: 2018-10-23 14:49:55 CEST psql > ERROR: deadlock detected 2018-10-23 14:49:55 CEST psql > DETAIL: Process 89171 waits for AccessExclusiveLock on relation 17582 of database 16390; blocked by process 50837. Process 50837 waits for AccessShareLock on relation 20767 of database 16390; blocked by process 89171. Process 89171: DROP TABLE IF EXISTS sm.tasks; Process 50837: autovacuum: ANALYZE sm.tasks This happenend CentOS 7 with Linux kernel 3.10.0-693 using PostgreSQL 9.6.6. There was discussion about similar issue without any conclusions 10 years ago, I'm not sure whether it's a bug or some documented behaviour. https://www.postgresql.org/message-id/flat/482CCD42.1060705%40students.mimuw.edu.pl Is there anything I can do make sure that DDL statement won't be canceled due to collision with autovaccum? Regards, Michal Merta ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Deadlock while doing VACUUM and DROP 2018-10-24 13:53 Deadlock while doing VACUUM and DROP Michal Merta <michal.merta@greycortex.com> @ 2018-10-24 14:02 ` Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2018-10-24 14:02 UTC (permalink / raw) To: Michal Merta <michal.merta@greycortex.com>; +Cc: pgsql-general@lists.postgresql.org Michal Merta <michal.merta@greycortex.com> writes: > I encountered deadlock during DROP TABLE statement: > 2018-10-23 14:49:55 CEST psql > ERROR: deadlock detected > 2018-10-23 14:49:55 CEST psql > DETAIL: Process 89171 waits for > AccessExclusiveLock on relation 17582 of database 16390; blocked by > process 50837. > Process 50837 waits for AccessShareLock on relation 20767 of > database 16390; blocked by process 89171. > Process 89171: DROP TABLE IF EXISTS sm.tasks; > Process 50837: autovacuum: ANALYZE sm.tasks Hm, there's more to that than meets the eye, because the locks were on two different tables. Have you checked which tables are involved, eg "select 20767::regclass"? > Is there anything I can do make sure that DDL statement won't be > canceled due to collision with autovaccum? I suspect your DDL transaction was getting exclusive locks on multiple tables. That's always hazardous. It might be easier to retry the DDL than try to guarantee no deadlock. Or break it up into separate transactions for each table. regards, tom lane ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-10-24 14:02 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-10-24 13:53 Deadlock while doing VACUUM and DROP Michal Merta <michal.merta@greycortex.com> 2018-10-24 14:02 ` Tom Lane <tgl@sss.pgh.pa.us>
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