Re: Does a cancelled REINDEX CONCURRENTLY need to be messy?

2023-07-06 Thread Peter Eisentraut
On 03.07.23 19:46, Álvaro Herrera wrote: Well, I definitely agree that it would be useful to have*something* that automatically removes debris Yeah, like "undo".

Re: Does a cancelled REINDEX CONCURRENTLY need to be messy?

2023-07-04 Thread Álvaro Herrera
On 2023-Jul-04, Michael Paquier wrote: > On Mon, Jul 03, 2023 at 07:46:27PM +0200, Alvaro Herrera wrote: > > Perhaps we could have autovacuum check for it, and do it > > separately of vacuum proper.) > > Being able to reuse some of the worker/launcher parts from autovacuum > could make things

Re: Does a cancelled REINDEX CONCURRENTLY need to be messy?

2023-07-03 Thread Michael Paquier
On Mon, Jul 03, 2023 at 07:46:27PM +0200, Alvaro Herrera wrote: > On 2023-Jul-01, Thom Brown wrote: >> On Thu, 29 Jun 2023, 14:45 Álvaro Herrera, wrote: >>> ALTER TABLE DETACH CONCURRENTLY had to deal with this also, and it did it >>> by having a COMPLETE option you can run later in case things

Re: Does a cancelled REINDEX CONCURRENTLY need to be messy?

2023-07-03 Thread Álvaro Herrera
On 2023-Jul-01, Thom Brown wrote: > On Thu, 29 Jun 2023, 14:45 Álvaro Herrera, wrote: > > > ALTER TABLE DETACH CONCURRENTLY had to deal with this also, and it did it > > by having a COMPLETE option you can run later in case things got stuck the > > first time around. I suppose we could do

Re: Does a cancelled REINDEX CONCURRENTLY need to be messy?

2023-07-01 Thread Thom Brown
On Thu, 29 Jun 2023, 14:45 Álvaro Herrera, wrote: > ALTER TABLE DETACH CONCURRENTLY had to deal with this also, and it did it > by having a COMPLETE option you can run later in case things got stuck the > first time around. I suppose we could do something similar, where the > server

Re: Does a cancelled REINDEX CONCURRENTLY need to be messy?

2023-06-29 Thread Álvaro Herrera
ALTER TABLE DETACH CONCURRENTLY had to deal with this also, and it did it by having a COMPLETE option you can run later in case things got stuck the first time around. I suppose we could do something similar, where the server automatically does the needful, whatever that is.

Re: Does a cancelled REINDEX CONCURRENTLY need to be messy?

2023-06-29 Thread Tom Lane
Andreas Karlsson writes: > On 6/29/23 11:13, Thom Brown wrote: >> I get the feeling that this is deliberate, and perhaps an attempt to >> mitigate locking issues, or some other explanation, but the rationale >> isn't immediately apparent to me if this is the case. > I have always assumed the

Re: Does a cancelled REINDEX CONCURRENTLY need to be messy?

2023-06-29 Thread Andreas Karlsson
On 6/29/23 11:13, Thom Brown wrote: I get the feeling that this is deliberate, and perhaps an attempt to mitigate locking issues, or some other explanation, but the rationale isn't immediately apparent to me if this is the case. I have always assumed the reason is that there might be other

Does a cancelled REINDEX CONCURRENTLY need to be messy?

2023-06-29 Thread Thom Brown
Hi, It's documented that a failed REINDEX can leave behind a transient index, and I'm not going to speculate on all the conditions that could lead to this situation. However, cancelling a REINDEX CONCURRENTLY will reliably leave behind the index it was building (_ccnew). Doesn't a cancellation