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 1q44pk-0002Ex-2V for pgsql-docs@arkaria.postgresql.org; Tue, 30 May 2023 19:16:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q44pg-000445-U3 for pgsql-docs@arkaria.postgresql.org; Tue, 30 May 2023 19:16:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q44pg-00043w-Mf for pgsql-docs@lists.postgresql.org; Tue, 30 May 2023 19:16:36 +0000 Received: from mout-u-107.mailbox.org ([80.241.59.207]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q44pZ-002kjU-Mp for pgsql-docs@lists.postgresql.org; Tue, 30 May 2023 19:16:35 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4QW2F45MdYz9sS7; Tue, 30 May 2023 21:16:24 +0200 (CEST) Date: Tue, 30 May 2023 21:16:23 +0200 (CEST) From: Erik Wienhold To: vasiliauskas.mg@gmail.com, pgsql-docs@lists.postgresql.org Message-ID: <585296650.518007.1685474183992@office.mailbox.org> In-Reply-To: <168542321808.1230020.11749247868403452374@wrigleys.postgresql.org> References: <168542321808.1230020.11749247868403452374@wrigleys.postgresql.org> Subject: Re: 5.11.1 Table Partitioning Overview - "...the size of the table should exceed the physical memory.." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4QW2F45MdYz9sS7 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 30/05/2023 07:06 CEST PG Doc comments form wrote: > > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/15/ddl-partitioning.html > Description: > > Is this rule of thumb a typo? > > "The exact point at which a table will benefit from partitioning depends on > the application, although a rule of thumb is that the size of the table > should exceed the physical memory of the database server." > > I believe it should say the "a rule of thumb is that the size of the table > should NOT exceed the physical memory of the database server." That rule of thumb is correct (or at least not wrong). The reasoning behind it is that table partitioning provides a benefit if individual partitions fit into physical memory and queries target just a few partitions instead of the entire table. Subsequent queries will benefit if the necessary tables have already been loaded into memory. If a table does not fit into memory, Postgres will have to constantly swap out memory. Also work_mem may be exceeded sooner with larger tables and Postgres has to eventually write temporary files to disk to store intermediate results, e.g. for sorting and hashing. Physical memory means RAM, not disk, if that's your issue here. -- Erik