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 1nw8O2-0007yW-Hy for pgsql-hackers@arkaria.postgresql.org; Tue, 31 May 2022 20:22:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nw8O0-0006kU-Bs for pgsql-hackers@arkaria.postgresql.org; Tue, 31 May 2022 20:22:40 +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 1nw8Nz-0006kK-Tz for pgsql-hackers@lists.postgresql.org; Tue, 31 May 2022 20:22:40 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nw8Nv-00049u-4j for pgsql-hackers@lists.postgresql.org; Tue, 31 May 2022 20:22:39 +0000 Received: from [192.168.28.32] (cyclops.postgrespro.ru [93.174.131.138]) (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 684BF21C1C1F; Tue, 31 May 2022 23:22:32 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1654028553; bh=RD6oUbxjNAZRajPF0Hd+Q5q3plDs5HZ9L8EbApgxIgY=; h=Date:Subject:To:References:From:In-Reply-To; b=M309Mt9lnsjQte0h6lt1Gw6qD/PSGApV93AYO5rnoCNlVcmQ+lIEyxLMjsd/8VfgS b8FvytuLVI0G3Vo+mwU9S+XLJDNBYoQtGdrr6ZSS+/XLNWMADUsedu99EhOkKEj/pl UauS42+hXu1gn98F2sUyJJn4ZMRwHmx0RaBQGkyw= Message-ID: <87b560e3-c5fa-ab78-4109-20f8aa24f5cc@postgrespro.ru> Date: Tue, 31 May 2022 23:22:32 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands Content-Language: en-US To: Laurenz Albe , PostgreSQL Hackers References: <163714495450.16056.3566953095730878367@malur.postgresql.org> From: Dmitry Koval In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > I didn't read the patch, but what lock level does that place on the > partitioned table? Anything more than ACCESS SHARE? Current patch locks a partitioned table with ACCESS EXCLUSIVE lock. Unfortunately only this lock guarantees that other session can not work with partitions that are splitting or merging. I want add CONCURRENTLY mode in future. With this mode partitioned table during SPLIT/MERGE operation will be locked with SHARE UPDATE EXCLUSIVE (as ATTACH/DETACH PARTITION commands in CONCURRENTLY mode). But in this case queries from other sessions that want to work with partitions that are splitting/merging at this time should receive an error (like "Partition data is moving. Repeat the operation later") because old partitions will be deleted at the end of SPLIT/MERGE operation. I hope exists a better solution, but I don't know it now... -- With best regards, Dmitry Koval Postgres Professional: http://postgrespro.com