pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Michael Guissine <mguissine@gmail.com>
To: Julien Rouhaud <rjuju123@gmail.com>
To: Alexander Korotkov <akorotkov@postgresql.org>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17652: Performance degradation after migrating from v13.4 to v14.4
Date: Wed, 19 Oct 2022 13:12:12 -0700
Message-ID: <20221019201212.qt2kucgkq3abguix@awork3.anarazel.de> (raw)
In-Reply-To: <CACxDrAm6x9MWvkz14_7D_uWcoAtyx7WaMOUmvv1fEayM+Cbe3w@mail.gmail.com>
References: <17652-6dc857c92440a189@postgresql.org>
	<20221019184606.qviaworoq73ozte3@awork3.anarazel.de>
	<CACxDrAm6x9MWvkz14_7D_uWcoAtyx7WaMOUmvv1fEayM+Cbe3w@mail.gmail.com>

Hi,

On 2022-10-19 15:32:17 -0400, Michael Guissine wrote:
> The column names in the plan and queries are obfuscated

I guessed so :)


> Indexes:
>     "partitioned_table_pkey" PRIMARY KEY, btree (partition_key, id)
>     "partitioned_table_partition_key_start_time_index" btree
> (partition_key, start_time)
>     "partitioned_table_partition_key_start_time_text" btree
> (partition_key, start_time, text)
>     "partitioned_table_partition_key_text_idx" gin (partition_key,
> text gin_trgm_ops)
>     "partitioned_table_text_tsv_index" gin
> (to_tsvector('simple'::regconfig, text)) WHERE text IS NOT NULL
> Number of partitions: 128 (Use \d+ to list them.)

Ok, that explains why we see the massive rechecks. For the bitmap scans we end
up using a gin index instead of the btree index.

The reason you're seeing this in 14 is likely the following entry in the
release notes:

> Allow GiST/GIN pg_trgm indexes to do equality lookups (Julien Rouhaud)
> This is similar to LIKE except no wildcards are honored.

CCed author/committer of that change. I suspect this would need proper costing
to not be inadvertently be used.


I assume you need the pg_trgm index?


In theory you could likely work around the issue by reverting the relevant
catalog change:

+ALTER OPERATOR FAMILY gin_trgm_ops USING gin ADD
+        OPERATOR        11       pg_catalog.= (text, text);

by issuing

ALTER OPERATOR FAMILY gin_trgm_ops USING gin DROP OPERATOR 11 (text, text);

but I suspect you won't be allowed to do that in RDS.

Greetings,

Andres Freund





view thread (13+ messages)  latest in thread

Message-ID: <20221019201212.qt2kucgkq3abguix@awork3.anarazel.de>
Permalink:  ../20221019201212.qt2kucgkq3abguix@awork3.anarazel.de/
Also on:    postgresql.org/message-id/20221019201212.qt2kucgkq3abguix@awork3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, mguissine@gmail.com, rjuju123@gmail.com, akorotkov@postgresql.org
  Subject: Re: BUG #17652: Performance degradation after migrating from v13.4 to v14.4
  In-Reply-To: <20221019201212.qt2kucgkq3abguix@awork3.anarazel.de>
  References: <17652-6dc857c92440a189@postgresql.org> <20221019184606.qviaworoq73ozte3@awork3.anarazel.de> <CACxDrAm6x9MWvkz14_7D_uWcoAtyx7WaMOUmvv1fEayM+Cbe3w@mail.gmail.com> <20221019201212.qt2kucgkq3abguix@awork3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox