pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: kochismo@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #9737: Trigram Regex degenerate case
Date: Wed, 26 Mar 2014 17:32:28 +0000
Message-ID: <20140326173228.26598.9250@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:      9737
Logged by:          Ka Chun Leung
Email address:      kochismo@gmail.com
PostgreSQL version: 9.3.4
Operating system:   Ubuntu Lucid
Description:        

Trigram regexes don't seem to handle ranges well.

Without ranges my query runs fine:

explain analyse select * from foos where foo::text ~ 'abc.+def'

Bitmap Heap Scan on foos  (cost=23032.42..25164.29 rows=571 width=56)
(actual time=57.996..62.183 rows=43 loops=1)
  Recheck Cond: ((foo)::text ~ 'abc.+def'::text)
  Rows Removed by Index Recheck: 953
  ->  Bitmap Index Scan on idx_foos_foo_trgm_gin  (cost=0.00..23032.28
rows=571 width=0) (actual time=57.741..57.741 rows=996 loops=1)
        Index Cond: ((foo)::text ~ 'abc.+def'::text)
Total runtime: 62.211 ms

With ranges:

explain analyse select * from foos where foo::text ~ 'abc[0-9]+def'

Bitmap Heap Scan on foos  (cost=27588.42..29720.29 rows=571 width=56)
(actual time=7844.767..7844.993 rows=3 loops=1)
  Recheck Cond: ((foo)::text ~ 'abc[0-9]+def'::text)
  Rows Removed by Index Recheck: 35
  ->  Bitmap Index Scan on idx_foos_foo_trgm_gin  (cost=0.00..27588.28
rows=571 width=0) (actual time=7844.510..7844.510 rows=38 loops=1)
        Index Cond: ((foo)::text ~ 'abc[0-9]+def'::text)
Total runtime: 7845.039 ms



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



Message-ID: <20140326173228.26598.9250@wrigleys.postgresql.org>
Permalink:  ../20140326173228.26598.9250@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20140326173228.26598.9250@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: kochismo@gmail.com
  Subject: Re: BUG #9737: Trigram Regex degenerate case
  In-Reply-To: <20140326173228.26598.9250@wrigleys.postgresql.org>
  References: <20140326173228.26598.9250@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