Re: XX000: tuple concurrently deleted during DROP STATISTICS - Mailing list pgsql-hackers

From Tom Lane
Subject Re: XX000: tuple concurrently deleted during DROP STATISTICS
Date
Msg-id 683594.1699458748@sss.pgh.pa.us
Whole thread Raw
In response to Re: XX000: tuple concurrently deleted during DROP STATISTICS  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Responses Re: XX000: tuple concurrently deleted during DROP STATISTICS
List pgsql-hackers
Tomas Vondra <tomas.vondra@enterprisedb.com> writes:
> On 11/8/23 16:10, Justin Pryzby wrote:
>> I found this in our logs, and reproduced it under v11-v16.
>> 
>> CREATE TABLE t(a int, b int);
>> INSERT INTO t SELECT generate_series(1,999);
>> CREATE STATISTICS t_stats ON a,b FROM t;
>> 
>> while :; do psql postgres -qtxc "ANALYZE t"; done &
>> while :; do psql postgres -qtxc "begin; DROP STATISTICS t_stats"; done &
>> 
>> It's known that concurrent DDL can hit elog().  But in this case,
>> there's only one DDL operation.

> AFAICS this happens because store_statext (after ANALYZE builds the new
> statistics) does this:

Shouldn't DROP STATISTICS be taking a lock on the associated table
that is strong enough to lock out ANALYZE?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: XX000: tuple concurrently deleted during DROP STATISTICS
Next
From: Alvaro Herrera
Date:
Subject: Re: meson documentation build open issues