Re: SELECT with LIKE clause makes full table scan - Mailing list pgsql-general

From Julien Rouhaud
Subject Re: SELECT with LIKE clause makes full table scan
Date
Msg-id CAOBaU_ZXuCZ1pigaoiBbq_23qcvWqEvLbyy1EmVQWYkVuMFJ8Q@mail.gmail.com
Whole thread Raw
In response to Re: SELECT with LIKE clause makes full table scan  (Matthias Apitz <guru@unixarea.de>)
Responses Re: SELECT with LIKE clause makes full table scan  (Matthias Apitz <guru@unixarea.de>)
List pgsql-general
Hi,

On Wed, Jan 26, 2022 at 11:07 PM Matthias Apitz <guru@unixarea.de> wrote:
>
> We changed two relevant Indexes to
>
> CREATE INDEX d01ort ON d01buch(d01ort bpchar_pattern_ops );
> CREATE INDEX d01ort2 ON d01buch(d01ort2 bpchar_pattern_ops );

When you said changed, did you drop the previous ones?  As Tom
mentioned, those indexes are specialized and are only useful for LIKE
'something%' queries.  It's quite likely that your existing indexes
were useful for other queries, which may not be as fast without those
indexes.  You can check in pg_stat_user_indexes if your indexes seems
to be used before actually dropping them for instance:
https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ALL-INDEXES-VIEW



pgsql-general by date:

Previous
From: Matthias Apitz
Date:
Subject: Re: SELECT with LIKE clause makes full table scan
Next
From: Matthias Apitz
Date:
Subject: Re: SELECT with LIKE clause makes full table scan