pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ATTACH/DETACH partitions and locking
4+ messages / 2 participants
[nested] [flat]

* ATTACH/DETACH partitions and locking
@ 2019-06-13 12:14  Pavel Luzanov <p.luzanov@postgrespro.ru>
  0 siblings, 1 reply; 4+ messages in thread

From: Pavel Luzanov @ 2019-06-13 12:14 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org

Hello,

According to patch[1] and after playing with v12 beta1 I think that this 
item can be dropped from "5.11.3. Implementation Using Inheritance" 
section of v12 docs:

"Some operations require a stronger lock when using declarative 
partitioning than when using table inheritance. For example, adding or 
removing a partition to or 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."

Small patch attached.


[1] ATTACH/DETACH PARTITION CONCURRENTLY
https://www.postgresql.org/message-id/flat/CAKJS1f9QjUwQrio20Pi=yCHmnouf4z3SfN8sqXaAcwREG6k0zQ@mail....

-- 

-----
Pavel Luzanov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

  [text/x-patch] ddlsgml.patch (809B, ../../642e9fbc-b832-698b-9a8f-d626afd7014d@postgrespro.ru/2-ddlsgml.patch)
  download | inline diff:
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index ed2d9c60d5..f9feec3125 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -4057,17 +4057,6 @@ ALTER INDEX measurement_city_id_logdate_key
         might be poor.)
        </para>
       </listitem>
-
-      <listitem>
-       <para>
-        Some operations require a stronger lock when using declarative
-        partitioning than when using table inheritance.  For example, adding
-        or removing a partition to or from a partitioned table requires taking
-        an <literal>ACCESS EXCLUSIVE</literal> lock on the parent table,
-        whereas a <literal>SHARE UPDATE EXCLUSIVE</literal> lock is enough
-        in the case of regular inheritance.
-       </para>
-      </listitem>
      </itemizedlist>
     </para>
 

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: ATTACH/DETACH partitions and locking
@ 2019-06-13 20:07  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: Pavel Luzanov <p.luzanov@postgrespro.ru>
  0 siblings, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2019-06-13 20:07 UTC (permalink / raw)
  To: Pavel Luzanov <p.luzanov@postgrespro.ru>; +Cc: pgsql-docs@lists.postgresql.org

On 2019-Jun-13, Pavel Luzanov wrote:

> Hello,
> 
> According to patch[1] and after playing with v12 beta1 I think that this
> item can be dropped from "5.11.3. Implementation Using Inheritance" section
> of v12 docs:
> 
> "Some operations require a stronger lock when using declarative partitioning
> than when using table inheritance. For example, adding or removing a
> partition to or 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."

Hmm ... while you're correct that ALTER TABLE ATTACH PARTITION no longer
uses AccessExclusive lock, ALTER TABLE DETACH PARTITION continues to.
So we could remove the "adding to" bit of the paragraph, but not remove
it completely.

https://www.postgresql.org/message-id/CA%2BTgmoY13KQZF-%3DHNTrt9UYWYx3_oYOQpu9ioNT49jGgiDpUEA%40mail...

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: ATTACH/DETACH partitions and locking
@ 2019-06-14 11:35  Pavel Luzanov <p.luzanov@postgrespro.ru>
  parent: Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Pavel Luzanov @ 2019-06-14 11:35 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: pgsql-docs@lists.postgresql.org


On 13.06.2019 23:07, Alvaro Herrera wrote:
> On 2019-Jun-13, Pavel Luzanov wrote:
>
>> Hello,
>>
>> According to patch[1] and after playing with v12 beta1 I think that this
>> item can be dropped from "5.11.3. Implementation Using Inheritance" section
>> of v12 docs:
>>
>> "Some operations require a stronger lock when using declarative partitioning
>> than when using table inheritance. For example, adding or removing a
>> partition to or 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."
> Hmm ... while you're correct that ALTER TABLE ATTACH PARTITION no longer
> uses AccessExclusive lock, ALTER TABLE DETACH PARTITION continues to.
> So we could remove the "adding to" bit of the paragraph, but not remove
> it completely.
>
> https://www.postgresql.org/message-id/CA%2BTgmoY13KQZF-%3DHNTrt9UYWYx3_oYOQpu9ioNT49jGgiDpUEA%40mail...
You are right, I missed the point with DETACH.

Does it make sense to change this way?
"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."

-----
Pavel Luzanov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: ATTACH/DETACH partitions and locking
@ 2020-05-20 18:43  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: Pavel Luzanov <p.luzanov@postgrespro.ru>
  0 siblings, 0 replies; 4+ messages in thread

From: Alvaro Herrera @ 2020-05-20 18:43 UTC (permalink / raw)
  To: Pavel Luzanov <p.luzanov@postgrespro.ru>; +Cc: pgsql-docs@lists.postgresql.org

On 2019-Jun-14, Pavel Luzanov wrote:

> Does it make sense to change this way?
> "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."

It took long -- pushed now.

Thanks for reporting

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2020-05-20 18:43 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 12:14 ATTACH/DETACH partitions and locking Pavel Luzanov <p.luzanov@postgrespro.ru>
2019-06-13 20:07 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2019-06-14 11:35   ` Pavel Luzanov <p.luzanov@postgrespro.ru>
2020-05-20 18:43     ` Alvaro Herrera <alvherre@2ndquadrant.com>

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