pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthias Apitz <guru@unixarea.de>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: Matthias Apitz <guru@unixarea.de>
Cc: Dominique Devienne <ddevienne@gmail.com>
Cc: Josef Šimánek <josef.simanek@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: SELECT with LIKE clause makes full table scan
Date: Wed, 26 Jan 2022 16:28:33 +0100
Message-ID: <YfFoobLLLF5wjPFp@c720-r368166> (raw)
In-Reply-To: <CAOBaU_ZXuCZ1pigaoiBbq_23qcvWqEvLbyy1EmVQWYkVuMFJ8Q@mail.gmail.com>
References: <YfEoqiHQikgT82PB@c720-r368166>
	<CAFp7QwrVFvMr9VOEsEQRBLhAcg9vG1AQwrg8S+mTmJ_f4Dp3sQ@mail.gmail.com>
	<YfEy7Y4gpoMbKlkB@pureos>
	<20220126121306.k6ilsxl7vy2ppmjn@jrouhaud>
	<CAFCRh--nsj2afcFP0iFU6_n9Hb4bSBmGu+YktkkZ8GwDXf1rYQ@mail.gmail.com>
	<20220126135139.uik5gbuzyxybxq4x@jrouhaud>
	<YfFjsGid9ZbjRxSU@c720-r368166>
	<CAOBaU_ZXuCZ1pigaoiBbq_23qcvWqEvLbyy1EmVQWYkVuMFJ8Q@mail.gmail.com>

El día miércoles, enero 26, 2022 a las 11:21:12p. m. +0800, Julien Rouhaud escribió:

> 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?  

Yes, of course.

> 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

Thanks, we're still investigating more cases with LIKE clause and will
consider your hint.

	matthias


-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub





view thread (12+ messages)

Message-ID: <YfFoobLLLF5wjPFp@c720-r368166>
Permalink:  ../YfFoobLLLF5wjPFp@c720-r368166/
Also on:    postgresql.org/message-id/YfFoobLLLF5wjPFp@c720-r368166

 · 

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-general@postgresql.org
  Cc: guru@unixarea.de, rjuju123@gmail.com, ddevienne@gmail.com, josef.simanek@gmail.com
  Subject: Re: SELECT with LIKE clause makes full table scan
  In-Reply-To: <YfFoobLLLF5wjPFp@c720-r368166>
  References: <YfEoqiHQikgT82PB@c720-r368166> <CAFp7QwrVFvMr9VOEsEQRBLhAcg9vG1AQwrg8S+mTmJ_f4Dp3sQ@mail.gmail.com> <YfEy7Y4gpoMbKlkB@pureos> <20220126121306.k6ilsxl7vy2ppmjn@jrouhaud> <CAFCRh--nsj2afcFP0iFU6_n9Hb4bSBmGu+YktkkZ8GwDXf1rYQ@mail.gmail.com> <20220126135139.uik5gbuzyxybxq4x@jrouhaud> <YfFjsGid9ZbjRxSU@c720-r368166> <CAOBaU_ZXuCZ1pigaoiBbq_23qcvWqEvLbyy1EmVQWYkVuMFJ8Q@mail.gmail.com> <YfFoobLLLF5wjPFp@c720-r368166>

* 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