pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ruslan.zakirov@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14032: trigram index is not used for '=' operator
Date: Fri, 18 Mar 2016 10:04:27 +0000
Message-ID: <20160318100427.2903.57536@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14032
Logged by:          Ruslan
Email address:      ruslan.zakirov@gmail.com
PostgreSQL version: 9.4.6
Operating system:   linux
Description:        

Hi,

Have table with the following index:

"tags_local_name_trg" gin (lower(name::text) gin_trgm_ops)

Was surprised that I have to use LIKE op to activate index:

sports=> explain analyze select id from tags_local where lower(name) =
'xx';
                                                 QUERY PLAN                 
                                
-------------------------------------------------------------------------------------------------------------
 Seq Scan on tags_local  (cost=0.00..8647.17 rows=729 width=4) (actual
time=188.669..188.669 rows=0 loops=1)
   Filter: (lower((name)::text) = 'xx'::text)
   Rows Removed by Filter: 145887
 Planning time: 0.298 ms
 Execution time: 188.695 ms
(5 rows)

sports=> explain analyze select id from tags_local where lower(name) like
'xx';
                                                          QUERY PLAN        
                                                 
------------------------------------------------------------------------------------------------------------------------------
 Bitmap Heap Scan on tags_local  (cost=9.01..122.71 rows=729 width=4)
(actual time=1.014..1.014 rows=0 loops=1)
   Recheck Cond: (lower((name)::text) ~~ 'xx'::text)
   ->  Bitmap Index Scan on tags_local_name_trg  (cost=0.00..8.82 rows=729
width=0) (actual time=1.013..1.013 rows=0 loops=1)
         Index Cond: (lower((name)::text) ~~ 'xx'::text)
 Planning time: 0.546 ms
 Execution time: 1.076 ms
(6 rows)




-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (7+ messages)  latest in thread

Message-ID: <20160318100427.2903.57536@wrigleys.postgresql.org>
Permalink:  ../20160318100427.2903.57536@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160318100427.2903.57536@wrigleys.postgresql.org

 · 

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: ruslan.zakirov@gmail.com
  Subject: Re: BUG #14032: trigram index is not used for '=' operator
  In-Reply-To: <20160318100427.2903.57536@wrigleys.postgresql.org>
  References: <20160318100427.2903.57536@wrigleys.postgresql.org>

* 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