Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1leFFm-0005sB-3B for pgsql-hackers@arkaria.postgresql.org; Wed, 05 May 2021 10:59:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1leFFE-00014B-NL for pgsql-hackers@arkaria.postgresql.org; Wed, 05 May 2021 10:59:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1leFFE-000143-At for pgsql-hackers@lists.postgresql.org; Wed, 05 May 2021 10:59:08 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1leFF7-0005KV-Bi for pgsql-hackers@lists.postgresql.org; Wed, 05 May 2021 10:59:07 +0000 Received: from [10.0.1.15] (unknown [188.123.231.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id C5C7221C8019; Wed, 5 May 2021 13:58:59 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1620212339; bh=aTM26/BT+WfNCKo/n4yBCHOmNb9DXA35WEJuBJ1387M=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=WXJRA6VPK+g4Y/JBhB7eRGfY7mq050O4HWIfrAAXed68tJ2nf+qmfKlRHP1hnhfB4 v8MbOdhiCJTGPPEN5VOL0dNQbVoRKXMicyFvOr4wg1LYfL13Sio1IrVhONMQnf8W2B Svm/zpuDEV0WfON3wRC8pquJk+KibGKLKFfegR/Y= Subject: Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY To: Amit Langote , =?UTF-8?Q?=c3=81lvaro_Herrera?= Cc: Justin Pryzby , Tom Lane , "pgsql-hackers@lists.postgresql.org" References: <20210427163226.GA30032@alvherre.pgsql> <20210427233211.GA21358@alvherre.pgsql> From: Pavel Luzanov Message-ID: <0688e7c3-8bc8-a3e4-9d8e-3bcbbf3e1f4d@postgrespro.ru> Date: Wed, 5 May 2021 13:58:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------9DFCB0A76C904B82BB745EB7" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------9DFCB0A76C904B82BB745EB7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello, I found this in the documentation, section '5.11.3. Partitioning Using Inheritance'[1]: "Some operations require a stronger lock when using declarative partitioning than when using table inheritance. For example, removing a partition from a partitioned table requires taking an ACCESS EXCLUSIVE lock on the parent table, whereas a SHARE UPDATE EXCLUSIVE lock is enough in the case of regular inheritance." This point is no longer valid with some restrictions. If the table has a default partition, then removing a partition still requires taking an ACCESS EXCLUSIVE lock. May be make sense to add some details about DETACH CONCURRENTLY to the section '5.11.2.2. Partition Maintenance' and completely remove this point? 1. https://www.postgresql.org/docs/devel/ddl-partitioning.html#DDL-PARTITIONING-USING-INHERITANCE Pavel Luzanov Postgres Professional: https://postgrespro.com The Russian Postgres Company --------------9DFCB0A76C904B82BB745EB7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Hello,

I found this in the documentation, section '5.11.3. Partitioning Using Inheritance'[1]:
"Some operations require a stronger lock when using declarative partitioning than when using table inheritance. For example, removing a partition from a partitioned table requires taking an ACCESS EXCLUSIVE lock on the parent table, whereas a SHARE UPDATE EXCLUSIVE lock is enough in the case of regular inheritance."

This point is no longer valid
with some restrictions. If the table has a default partition, then removing a partition still requires taking an ACCESS EXCLUSIVE lock.

May be make sense to add some details about DETACH CONCURRENTLY to the section '5.11.2.2. Partition Maintenance' and completely remove this point?

1. https://www.postgresql.org/docs/devel/ddl-partitioning.html#DDL-PARTITIONING-USING-INHERITANCE
Pavel Luzanov
Postgres Professional: https://postgrespro.com
The Russian Postgres Company

--------------9DFCB0A76C904B82BB745EB7--