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 1oDRo7-0003oS-Qh for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jul 2022 14:33:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oDRo6-0006KA-L2 for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jul 2022 14:33:10 +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 1oDRo6-0006Jw-8M for pgsql-hackers@lists.postgresql.org; Mon, 18 Jul 2022 14:33:10 +0000 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oDRo3-0005Ju-R0 for pgsql-hackers@lists.postgresql.org; Mon, 18 Jul 2022 14:33:09 +0000 Received: by mail-qk1-x734.google.com with SMTP id o1so8822346qkg.9 for ; Mon, 18 Jul 2022 07:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=oRAw3U545D1CoQVwscfOhRdzeZueatjusaQ8u/Q0W8g=; b=dkaufepiW6ew4tKChGi+8UYp5bxLC/IVHhF8j/9VdM5xGyrNszNyjI9hiJiAIg/wO/ OGg6twaZSrb7bWnEA7+00ijOHq4n+kUp2RDh59bsYECAbyDu3plaa1jP5Xht7QnI4Lcg m9ZkHk7fYV/tqSYaw5QESFF+nrzkT8IgGmsZLcNYIpBoyvnWq7SsPSrzZepCmD/Kq3k3 Ds/nFQSy5V/zaMtVWIbkJ5wAGMNPEWXQAHioANlTEMpEgE1Jxlhf81yMWIceguoR+EJa 2MXKtvoSwQtI9RHlM0v4L2Gib7V/ElQcWzkPr/YDOJ6huL1kF2EXo56T/nsbmS0CB/gX 0+UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=oRAw3U545D1CoQVwscfOhRdzeZueatjusaQ8u/Q0W8g=; b=t6nqRVT/40ZpIsaKdYhNVsPa6gOuyY5tw2lbbxe9R7NV8bE3GpjZtwNsQkCtVjGFhT x47F30ppM67PW2E8Nuontdy+IdFs9LX4Dpw+uO6n24h6ZTGdFG+qG9Ov4bzxjh1eNhI7 rTfMcjZPgxP+kjrPa2ceJKoAqvX4u7ZnHXCVCOBW1nem4vMlONOYDqEXDt0vGL3E24Bp YVXz/8U/xdMt/iGvKslUyfL8H1UXLqEu5aki0mkxnqL6kdpPCWxv/uxIhlq9yqcWdlF5 bMXeMUtai/27oxQgR+TWxUMWq5QOhgevNBdiJa5m82SdSWTdmHp414OGA12q5q+VFY0x wKAQ== X-Gm-Message-State: AJIora+xyhLxMhYIipvIT/PYiwHtSS0DIPzYVDJ0bsou6/iSY+VO9iG5 sJYyRwxxA/t4cBdZDwE1dDRXDg== X-Google-Smtp-Source: AGRyM1tfmruvbz4eZkxkCTcgcq78J5kwmJieMIhaWTzb09LLWuoZJugOUVXC3ggaMXlw2TBY2hCi7w== X-Received: by 2002:a05:620a:2847:b0:6aa:cdf8:f71e with SMTP id h7-20020a05620a284700b006aacdf8f71emr16958503qkp.598.1658154786206; Mon, 18 Jul 2022 07:33:06 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id u12-20020a05620a0c4c00b006a6ebde4799sm12337408qki.90.2022.07.18.07.33.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jul 2022 07:33:05 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 9E2A0800957; Mon, 18 Jul 2022 09:33:04 -0500 (CDT) Date: Mon, 18 Jul 2022 09:33:04 -0500 From: Justin Pryzby To: Robert Haas Cc: pgsql-hackers@lists.postgresql.org, David Rowley , Alvaro Herrera Subject: doc: mentioned CREATE+ATTACH PARTITION as an alternative to CREATE TABLE..PARTITION OF Message-ID: <20220718143304.GC18011@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk It's easy to use CREATE TABLE..LIKE + ALTER..ATTACH PARTITION to avoid acquiring a strong lock when creating a new partition. But it's also easy to forget. commit 76c0d1198cf2908423b321cd3340d296cb668c8e Author: Justin Pryzby Date: Mon Jul 18 09:24:55 2022 -0500 doc: mention CREATE+ATTACH PARTITION as an alternative to CREATE TABLE..PARTITION OF See also: 898e5e3290a72d288923260143930fb32036c00c Should backpatch to v12 diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 6bbf15ed1a4..db7d8710bae 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -619,6 +619,16 @@ WITH ( MODULUS numeric_literal, REM with DROP TABLE requires taking an ACCESS EXCLUSIVE lock on the parent table. + + + Note that creating a partition acquires an ACCESS + EXCLUSIVE lock on the parent table. + It may be preferable to first CREATE a separate table and then ATTACH it, + which does not require as strong of a lock. + See ATTACH PARTITION + and for more information. + +