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 1kyqoL-0003jO-VK for pgsql-general@arkaria.postgresql.org; Mon, 11 Jan 2021 06:36:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kyqoJ-0003W7-I5 for pgsql-general@arkaria.postgresql.org; Mon, 11 Jan 2021 06:36:15 +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 1kyqoJ-0003W0-AO for pgsql-general@lists.postgresql.org; Mon, 11 Jan 2021 06:36:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kyqoE-0002Wt-8O for pgsql-general@lists.postgresql.org; Mon, 11 Jan 2021 06:36:14 +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 10B6a81h820806; Mon, 11 Jan 2021 01:36:08 -0500 From: Tom Lane To: =?utf-8?B?0JPQvtC70YPQsdC10LLQsCDQr9C90LA=?= cc: "pgsql-general@lists.postgresql.org" Subject: Re: Define hash partition for certain column values In-reply-to: <2278581610342154@mail.yandex.ru> References: <2278581610342154@mail.yandex.ru> Comments: In-reply-to =?utf-8?B?0JPQvtC70YPQsdC10LLQsCDQr9C90LA=?= message dated "Mon, 11 Jan 2021 08:56:52 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <820804.1610346968.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 11 Jan 2021 01:36:08 -0500 Message-ID: <820805.1610346968@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?utf-8?B?0JPQvtC70YPQsdC10LLQsCDQr9C90LA=3D?=3D writ= es: > Hello, I've found in source code that there is a function satisfies_has= h_partition(oid, modulus, remainder, column_values[]) which allows to chec= k if the certain column value will be placed in the certain partition. I' = d like to know if there is an opportunity not to check the certain partiti= on but to define which partition will be the certain column value placed i= n. If you want to control what goes where, use list partitioning (or, perhaps, range partitioning). Hash is only suitable if you do not care which partition any particular row goes to. Personally, I think hash partitioning is mostly academic, precisely because of that. If the partitioning doesn't line up with application requirements, you give up too much of the benefit of using partitions. regards, tom lane