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 1mVLms-00051p-ND for pgsql-performance@arkaria.postgresql.org; Tue, 28 Sep 2021 22:41:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mVLmq-0000ZQ-OY for pgsql-performance@arkaria.postgresql.org; Tue, 28 Sep 2021 22:41:20 +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 1mVLmq-0000ZI-GT for pgsql-performance@lists.postgresql.org; Tue, 28 Sep 2021 22:41:20 +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 1mVLmo-0006ux-8z for pgsql-performance@lists.postgresql.org; Tue, 28 Sep 2021 22:41:19 +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 18SMfDCd2920282; Tue, 28 Sep 2021 18:41:13 -0400 From: Tom Lane To: Daniel Diniz cc: "pgsql-performance@lists.postgresql.org" Subject: Re: Problem with indices from 10 to 13 In-reply-to: References: <8d2ba21d-2318-4f02-a8fd-04c7d97e22ab.e854021a-9da0-4eba-a51f-e5ff782985ef.17ca0caa-f521-44ce-817a-17cbc713d135@emailsignatures365.codetwo.com> <2853352.1632851116@sss.pgh.pa.us> Comments: In-reply-to Daniel Diniz message dated "Tue, 28 Sep 2021 19:02:24 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2920280.1632868873.1@sss.pgh.pa.us> Date: Tue, 28 Sep 2021 18:41:13 -0400 Message-ID: <2920281.1632868873@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Daniel Diniz writes: > The index I use is the GIN. pg_trgm, you mean? That answers one question, but you still didn't explain what type h.nome_des is, nor how bytea and convert_from() are getting into the picture. The second part of that is probably not critical, since the planner should be willing to reduce the convert_from() call to a constant for planning purposes, so I'm unclear as to why the estimate for the ilike clause is so bad. Have you tried increasing the statistics target for h.nome_des to see if the estimate gets better? regards, tom lane