Tomas Vondra <tomas.von...@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


Reply via email to