pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Scalia <jayknowsunix@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Index not always being used
Date: Thu, 29 Aug 2019 10:15:28 -0400
Message-ID: <180F96D3-690E-466E-B73E-F6B34C6409C7@gmail.com> (raw)

I’ve got a table with approximately 5.5 million rows, and one column that is frequently searched is of type varchar(50)  and we just put a trigram index on it. Now, if we search “where bld_city = ‘baskingridge’”, explain says a sequential table scan is going to be used, but if I change the query to use “where bold_city like ‘basking%’”, then explain correctly shows that a bitmap index scan will be performed. Why would these two forms use different approaches? I’m a bit confused.
—
Jay

Sent from my iPad




view thread (4+ messages)  latest in thread

Message-ID: <180F96D3-690E-466E-B73E-F6B34C6409C7@gmail.com>
Permalink:  ../180F96D3-690E-466E-B73E-F6B34C6409C7@gmail.com/
Also on:    postgresql.org/message-id/180F96D3-690E-466E-B73E-F6B34C6409C7@gmail.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: jayknowsunix@gmail.com
  Subject: Re: Index not always being used
  In-Reply-To: <180F96D3-690E-466E-B73E-F6B34C6409C7@gmail.com>

* 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