Subject: Re: pg_trgm upgrade to 1.6 led to load average increase

From: Adrian Klaver <[email-masked]>
Date: Tue, 20 Jan 2026 08:34:17 -0800

On 1/20/26 00:50, Nicolas Seinlet wrote:
> Hello,
> 
> we've upgraded the pg_trgm extension from 1.0 to 1.6 on our production 
> database, while sticking our postgresql cluster version to 16. This led 
> to an increase in the load average of the server (twice the load average 
> on our use case). After investigation, we found our issue was linked to :
> https://github.com/postgres/postgres/ 
> commit/935f6666502250abde8615bc7805a6e5aa05a066 <https://github.com/ 
> postgres/postgres/commit/935f6666502250abde8615bc7805a6e5aa05a066>
> 
> We issue queries like :
> SELECT model, res_id FROM ir_model_data WHERE module='base' AND 
> name='public_user';

You need to provide the table definition, including indexes.

> Thanks in advance,
> Nicolas

-- 
Adrian Klaver
[email-masked]

---

From: Nicolas Seinlet <[email-masked]>
Date: Wed, 21 Jan 2026 08:38:56 +0000

Hello,

here is the table definition:

                                         Table "public.ir_model_data"
   Column    |            Type             | Collation | Nullable |                  Default
-------------+-----------------------------+-----------+----------+-------------------------------------------
 id          | integer                     |           | not null | nextval('ir_model_data_id_seq'::regclass)
 create_uid  | integer                     |           |          |
 create_date | timestamp without time zone |           |          | timezone('UTC'::text, now())
 write_date  | timestamp without time zone |           |          | timezone('UTC'::text, now())
 write_uid   | integer                     |           |          |
 noupdate    | boolean                     |           |          | false
 name        | character varying           |           | not null |
 module      | character varying           |           | not null |
 model       | character varying           |           | not null |
 res_id      | integer                     |           |          |
Indexes:
    "ir_model_data_pkey" PRIMARY KEY, btree (id)
    "ir_model_data_create_uid_idx" btree (create_uid) WHERE create_uid IS NOT NULL AND (create_uid <> ALL (ARRAY[1, 208196]))
    "ir_model_data_model_name_multilang_index" btree (name) WHERE model::text = ANY (ARRAY['account.account'::character varying::text, 'account.group'::character varying::text, 'account.tax'::character varying::text, 'account.fiscal.position'::character varying::text])
    "ir_model_data_model_res_id_index" btree (model, res_id)
    "ir_model_data_module_name_uniq_index" UNIQUE, btree (module, name)
    "ir_model_data_name_idx2" gist (name gist_trgm_ops)
    "ir_model_data_write_uid_idx" btree (write_uid) WHERE write_uid IS NOT NULL AND (write_uid <> ALL (ARRAY[1, 208196]))
Check constraints:
    "ir_model_data_name_nospaces" CHECK (name::text !~~ '% %'::text)