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 1l84Pc-0006bF-0j for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Feb 2021 16:56:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l84Pa-0002kb-7L for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Feb 2021 16:56:50 +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 1l84Pa-0002kT-1U for pgsql-bugs@lists.postgresql.org; Fri, 05 Feb 2021 16:56:50 +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 1l84PT-0002io-0x for pgsql-bugs@lists.postgresql.org; Fri, 05 Feb 2021 16:56:49 +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 115GucnB110774; Fri, 5 Feb 2021 11:56:39 -0500 From: Tom Lane To: stanislaw.skonieczny@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16855: No partition pruning when using partitions with custom hash function In-reply-to: <16855-32d2983ea6e6b208@postgresql.org> References: <16855-32d2983ea6e6b208@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 05 Feb 2021 10:44:32 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <110772.1612544198.1@sss.pgh.pa.us> Date: Fri, 05 Feb 2021 11:56:38 -0500 Message-ID: <110773.1612544198@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > I'd expect that only one partition will be scanned, other 2 will be removed > by partition pruning. It works if you write regression=# explain select * from sample where part_id = 1::bigint; QUERY PLAN ---------------------------------------------------------------------- Seq Scan on sample_part_1 sample (cost=0.00..38.25 rows=11 width=8) Filter: (part_id = '1'::bigint) (2 rows) As it stands, the query uses the "bigint = integer" operator, which you have not included in your custom opclass. regards, tom lane