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 1n8tbk-0004wi-E0 for pgsql-general@arkaria.postgresql.org; Sun, 16 Jan 2022 00:41:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n8tbj-0004hr-A6 for pgsql-general@arkaria.postgresql.org; Sun, 16 Jan 2022 00:41:19 +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 1n8tbi-0004hi-Vx for pgsql-general@lists.postgresql.org; Sun, 16 Jan 2022 00:41:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8tbf-0000In-TX for pgsql-general@lists.postgresql.org; Sun, 16 Jan 2022 00:41:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20G0fCow3621620; Sat, 15 Jan 2022 19:41:12 -0500 From: Tom Lane To: Mladen Gogala cc: pgsql-general@lists.postgresql.org Subject: Re: Assistance with an out of shared memory error In-reply-to: <434dde00-59d2-64c1-ebf0-bc2b8765b337@gmail.com> References: <3297903.1642116955@sss.pgh.pa.us> <434dde00-59d2-64c1-ebf0-bc2b8765b337@gmail.com> Comments: In-reply-to Mladen Gogala message dated "Sat, 15 Jan 2022 19:15:18 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3621618.1642293672.1@sss.pgh.pa.us> Date: Sat, 15 Jan 2022 19:41:12 -0500 Message-ID: <3621619.1642293672@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mladen Gogala writes: > On 1/13/22 18:35, Tom Lane wrote: >> .. or else reduce the number of partitions you're using. (People >> frequently seem to think that more partitions are free. That is >> extremely not true. I generally think that if you're using more >> than a few dozen partitions per table, you are making a mistake.) > Interesting. What resources do partitions consume? Locks, planning time, execution time, cache-management overhead. To the extent that all of your queries against a table can be "pruned" to only touch a few partitions, you might come out ahead on execution time; but I think few workloads are completely stylized like that. The poster-child use case for partitions is where you can make them fit a recurring bulk-deletion scenario; for instance, once a month you want to drop the oldest month's worth of data. If you've got terabytes of data then there's also something to be said for being able to split up vacuuming and other background overhead. But I think a lot of people are way too eager to apply partitioning where it doesn't fit, or to overuse it even where it does fit. regards, tom lane