Re: XX000: tuple concurrently deleted during DROP STATISTICS

2023-11-19 Thread Tomas Vondra
I've pushed a cleaned up version of the fix. I had to make some adjustments in the backbranches, because the way we store the analyzed statistics evolved, and RemoveStatisticsById() used to do everything. I ended up introducing RemoveStatisticsDataById() in the backbranches too, but only as a

Re: XX000: tuple concurrently deleted during DROP STATISTICS

2023-11-08 Thread Tomas Vondra
On 11/8/23 20:58, Tom Lane wrote: > Tomas Vondra writes: >> On 11/8/23 16:52, Tom Lane wrote: >>> Shouldn't DROP STATISTICS be taking a lock on the associated table >>> that is strong enough to lock out ANALYZE? > >> Yes, I think that's the correct thing to do. I recall having a >> discussion

Re: XX000: tuple concurrently deleted during DROP STATISTICS

2023-11-08 Thread Tom Lane
Tomas Vondra writes: > On 11/8/23 16:52, Tom Lane wrote: >> Shouldn't DROP STATISTICS be taking a lock on the associated table >> that is strong enough to lock out ANALYZE? > Yes, I think that's the correct thing to do. I recall having a > discussion about this with someone while working on the

Re: XX000: tuple concurrently deleted during DROP STATISTICS

2023-11-08 Thread Tomas Vondra
On 11/8/23 16:52, Tom Lane wrote: > Tomas Vondra 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; >>>

Re: XX000: tuple concurrently deleted during DROP STATISTICS

2023-11-08 Thread Tom Lane
Tomas Vondra 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

Re: XX000: tuple concurrently deleted during DROP STATISTICS

2023-11-08 Thread Tomas Vondra
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

XX000: tuple concurrently deleted during DROP STATISTICS

2023-11-08 Thread Justin Pryzby
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";