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 1lEbmy-00044p-Hy for pgsql-general@arkaria.postgresql.org; Tue, 23 Feb 2021 17:48:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lEbmw-00050B-6n for pgsql-general@arkaria.postgresql.org; Tue, 23 Feb 2021 17:47:58 +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 1lEbmv-000504-R4 for pgsql-general@lists.postgresql.org; Tue, 23 Feb 2021 17:47:57 +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 1lEbmr-0006Mw-UT for pgsql-general@lists.postgresql.org; Tue, 23 Feb 2021 17:47:56 +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 11NHloYB3875365; Tue, 23 Feb 2021 12:47:50 -0500 From: Tom Lane To: Ayo cc: pgsql-general@lists.postgresql.org Subject: Re: Custom base type and suboptimal query plans In-reply-to: References: <3822526.1614093860@sss.pgh.pa.us> <3873892.1614100834@sss.pgh.pa.us> Comments: In-reply-to Ayo message dated "Tue, 23 Feb 2021 18:43:37 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3875363.1614102470.1@sss.pgh.pa.us> Date: Tue, 23 Feb 2021 12:47:50 -0500 Message-ID: <3875364.1614102470@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ayo writes: > No luck. It uses the index now, but seemingly only to loop over it. The > integer version uses a HashAggregate, I must have missed something in my > implementation to make the planner avoid that node. Does it have any special > type requirements, other than the hash operator class? Hmm ... did you remember to set the oprcanhash property on the equality operator? regards, tom lane