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 1o2Coz-0005CS-AZ for pgsql-admin@arkaria.postgresql.org; Fri, 17 Jun 2022 14:19:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o2Coy-00053F-5s for pgsql-admin@arkaria.postgresql.org; Fri, 17 Jun 2022 14:19:36 +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 1o2Cox-000536-SL for pgsql-admin@lists.postgresql.org; Fri, 17 Jun 2022 14:19:35 +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 1o2Cov-0003kK-LC for pgsql-admin@lists.postgresql.org; Fri, 17 Jun 2022 14:19:34 +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 25HEJWeX1217743; Fri, 17 Jun 2022 10:19:32 -0400 From: Tom Lane To: Kenny Bachman cc: pgsql-admin@lists.postgresql.org Subject: Re: postrgesql query planner wrong desicion In-reply-to: References: Comments: In-reply-to Kenny Bachman message dated "Fri, 17 Jun 2022 11:48:00 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1217741.1655475572.1@sss.pgh.pa.us> Date: Fri, 17 Jun 2022 10:19:32 -0400 Message-ID: <1217742.1655475572@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Kenny Bachman writes: > With GIST Index: (Total exec time : 34s) > Index Scan using "Pool_Party_Code_gist" on "Pool_Party" (cost=0.28..8.30 > rows=1 width=4) (actual time=0.097..0.097 rows=1 loops=330870) > Index Cond: (("Code")::text = > 'TEAM-FIXPOWERUSER'::text) > Without GIST Index: (Total exec time: 4s) > Index Scan using "Pool_Party_Code_idx" on "Pool_Party" (cost=0.42..8.44 > rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=330870) > Index Cond: (("Code")::text = > 'TEAM-FIXPOWERUSER'::text) Why do you have a gist index on a column that's apparently plain text (or varchar)? It seems kinda pointless, and the more so if it duplicates a btree index. regards, tom lane