From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: mba.ogolny@gmail.com
Subject: BUG #17848: Deadlock when running ANALYZE on a table while REINDEX INDEX CONCURRENTLY is running
Date: Thu, 16 Mar 2023 19:47:53 +0000
Message-ID: <17848-fbeac774e88c0183@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17848
Logged by: Marcin BarczyĆski
Email address: mba.ogolny@gmail.com
PostgreSQL version: 13.10
Operating system: Ubuntu
Description:
In order to reproduce, first prepare the data:
DROP TABLE IF EXISTS demo;
CREATE TABLE demo(val BIGINT);
CREATE INDEX demo_idx ON demo(val);
INSERT INTO demo SELECT val FROM generate_series(1, 10000000) val;
Now, in one terminal run:
q=# REINDEX INDEX CONCURRENTLY demo_idx;
And immediately in the other:
q=# ANALYZE demo;
When REINDEX INDEX CONCURRENTLY is about to finish, it fails with:
ERROR: deadlock detected
DETAIL: Process 762797 waits for ShareLock on virtual transaction 4/32405;
blocked by process 752318.
Process 752318 waits for ShareUpdateExclusiveLock on relation 202300 of
database 58517; blocked by process 762797.
HINT: See server log for query details.
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, mba.ogolny@gmail.com
Subject: Re: BUG #17848: Deadlock when running ANALYZE on a table while REINDEX INDEX CONCURRENTLY is running
In-Reply-To: <17848-fbeac774e88c0183@postgresql.org>
* 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