Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihw0s-0000qH-GO for pgsql-general@arkaria.postgresql.org; Thu, 19 Dec 2019 13:38:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ihw0q-0005uK-Kc for pgsql-general@arkaria.postgresql.org; Thu, 19 Dec 2019 13:38:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihw0q-0005uA-77 for pgsql-general@lists.postgresql.org; Thu, 19 Dec 2019 13:38:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ihw0m-0003Ff-3A for pgsql-general@postgresql.org; Thu, 19 Dec 2019 13:38:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xBJDcaBF006715; Thu, 19 Dec 2019 08:38:38 -0500 From: Tom Lane To: James Sewell cc: pgsql-general Subject: Re: Partitioned tables and locks In-reply-to: References: Comments: In-reply-to James Sewell message dated "Thu, 19 Dec 2019 21:04:41 +1100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6713.1576762716.1@sss.pgh.pa.us> Date: Thu, 19 Dec 2019 08:38:36 -0500 Message-ID: <6714.1576762716@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk James Sewell writes: > Is it expected that a lock on a partitioned table will take out 2 locks per > child regardless of the number of children which are excluded at plan time? Depends on the details of your query, and on which PG version you're using, but it's by no means surprising for each child table to get locked. (I'm not sure where *two* locks would come from, though.) If you're working with massively partitioned tables, increasing max_locks_per_transaction is a good idea. regards, tom lane