Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vib3p-00Ahp4-1N for pgsql-general@arkaria.postgresql.org; Wed, 21 Jan 2026 16:28:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vib3o-008AQC-1h for pgsql-general@arkaria.postgresql.org; Wed, 21 Jan 2026 16:28:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vib3o-008AQ3-0b for pgsql-general@lists.postgresql.org; Wed, 21 Jan 2026 16:28:00 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vib3m-001kRH-0c for pgsql-general@lists.postgresql.org; Wed, 21 Jan 2026 16:27:59 +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 60LGRucj2215068; Wed, 21 Jan 2026 11:27:56 -0500 From: Tom Lane To: Nicolas Seinlet cc: "pgsql-general@lists.postgresql.org" Subject: Re: pg_trgm upgrade to 1.6 led to load average increase In-reply-to: References: Comments: In-reply-to Nicolas Seinlet message dated "Tue, 20 Jan 2026 08:50:33 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2215066.1769012876.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 21 Jan 2026 11:27:56 -0500 Message-ID: <2215067.1769012876@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nicolas Seinlet writes: > We issue queries like : > SELECT model, res_id FROM ir_model_data WHERE module=3D'base' AND name=3D= 'public_user'; > With 1.0 extension, the query is planned with a matching btree index: > "ir_model_data_module_name_uniq_index" UNIQUE, btree (module, name) > With 1.6 extension, the query is planned with a gist index: > "ir_model_data_name_idx2" gist (name gist_trgm_ops) > 1.0 extension executes the query in 0.1ms, while 1.6 in 100ms It seems quite odd that the planner would prefer an index using only one of the two clauses. It must be concluding that the gist indexscan will be cheaper, but it's hard to see why that would be. Could we see EXPLAIN ANALYZE output for those two cases? Are the statistics for the table up-to-date? regards, tom lane