From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Andy Fan <zhihui.fan1213@gmail.com>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY
Date: Wed, 14 Oct 2020 22:08:40 -0300
Message-ID: <20201015010840.GA20821@alvherre.pgsql> (raw)
In-Reply-To: <CAKU4AWrme6KPToAGJrzPFwaLu_aFqAoXbiSKLR8HTnDwB00z2A@mail.gmail.com>
On 2020-Oct-15, Andy Fan wrote:
> I think if it is possible to implement the detech with a NoWait option .
>
> ALTER TABLE ... DETACH PARTITION .. [NoWait].
>
> if it can't get the lock, raise "Resource is Busy" immediately,
> without blocking others. this should be a default behavior. If
> people do want to keep trying, it can set a ddl_lock_timeout to
> 'some-interval', in this case, it will still block others(so it can't
> be as good as what you are doing, but very simple), however the user
> would know what would happen exactly and can coordinate with their
> application accordingly. I'm sorry about this since it is a bit of
> off-topics or it has been discussed already.
Hi. I don't think this has been discussed, but it doesn't really solve
the use case I want to -- in many cases where the tables are
continuously busy, this would lead to starvation. I think the proposal
to make the algorithm work with reduced lock level is much more useful.
I think you can already do NOWAIT behavior, with LOCK TABLE .. NOWAIT
followed by DETACH PARTITION, perhaps with a nonzero statement timeout.
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-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, zhihui.fan1213@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY
In-Reply-To: <20201015010840.GA20821@alvherre.pgsql>
* 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