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 1mQV7v-000642-Qv for pgsql-bugs@arkaria.postgresql.org; Wed, 15 Sep 2021 13:39:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mQV7u-0007DT-Nw for pgsql-bugs@arkaria.postgresql.org; Wed, 15 Sep 2021 13:39:02 +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 1mQV7u-0007DL-H5 for pgsql-bugs@lists.postgresql.org; Wed, 15 Sep 2021 13:39:02 +0000 Received: from forward500p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b7:110]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQV7q-0001Dh-Dn for pgsql-bugs@lists.postgresql.org; Wed, 15 Sep 2021 13:39:01 +0000 Received: from iva6-2cc1dbf7c260.qloud-c.yandex.net (iva6-2cc1dbf7c260.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:610d:0:640:2cc1:dbf7]) by forward500p.mail.yandex.net (Yandex) with ESMTP id C631DF020CF; Wed, 15 Sep 2021 16:38:53 +0300 (MSK) Received: from 2a02:6b8:c0c:e1f:0:640:6477:8ce1 (2a02:6b8:c0c:e1f:0:640:6477:8ce1 [2a02:6b8:c0c:e1f:0:640:6477:8ce1]) by iva6-2cc1dbf7c260.qloud-c.yandex.net (mxback/Yandex) with HTTP id qcXZuC1D8mI1-crDW7VEb; Wed, 15 Sep 2021 16:38:53 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zsrv.org; s=mail; t=1631713133; bh=oZjonM+w78ix4UCfjoqO8FFZPHw0Xk7++/d9gsq4RFg=; h=References:Date:Message-Id:Cc:Subject:In-Reply-To:To:From; b=IJmyWM1Z/zbExjLuU5bmpfyRgUAaJxja+UILAQRssgNWQrGEFTj0Ltlc62fPBTVyJ Im++gS0443bDldnjXppm6K6e+mXeozPkJmpZkIYTFWlea1yjRJNglTcOS6LdRuLOs/ Fd7xrI/RIH/CANGfMtBYKkQqmrvYBokPlE3OCsXM= Authentication-Results: iva6-2cc1dbf7c260.qloud-c.yandex.net; dkim=pass header.i=@zsrv.org Received: by iva5-64778ce1ba26.qloud-c.yandex.net with HTTP; Wed, 15 Sep 2021 16:38:53 +0300 From: Sergei Kornilov To: Yudianto Prasetyo Cc: Peter Smith , PostgreSQL mailing lists In-Reply-To: References: <189541631708874@mail.yandex.ru> Subject: Re: bugs or my fault MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Wed, 15 Sep 2021 16:38:53 +0300 Message-Id: <176211631710564@mail.yandex.ru> Content-Transfer-Encoding: 7bit Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk We don't do just id % 3, we calculate some hash value from partition key (id) and route the tuple according this hash value. Such condition for your example: select *, satisfies_hash_partition('myschema.customers'::regclass, 3, 0, id) as modulus3_remainder0_target_partition from myschema.cust0; Can't illustrate more at the SQL level due to the lack of a uint64 calculations. At C level we are here: https://github.com/postgres/postgres/blob/REL_13_STABLE/src/backend/partitioning/partbounds.c#L4595 regards, Sergei