BUG #9737: Trigram Regex degenerate case - Mailing list pgsql-bugs

From kochismo@gmail.com
Subject BUG #9737: Trigram Regex degenerate case
Date
Msg-id 20140326173228.26598.9250@wrigleys.postgresql.org
Whole thread Raw
List pgsql-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

pgsql-bugs by date:

Previous
From: Martin Vassilev
Date:
Subject: Re: BUG #9722: select ILIKE is not case insensitive in UTF8 cyrillic
Next
From: Dang Minh Huong
Date:
Subject: Re: [HACKERS] Duplicated row after promote in synchronous streaming replication