BUG #9737: Trigram Regex degenerate case

From: kochismo(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #9737: Trigram Regex degenerate case
Date: 2014-03-26 17:32:28
Message-ID: 20140326173228.26598.9250@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 9737
Logged by: Ka Chun Leung
Email address: kochismo(at)gmail(dot)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

Browse pgsql-bugs by date

  From Date Subject
Next Message Dang Minh Huong 2014-03-26 22:07:01 Re: [HACKERS] Duplicated row after promote in synchronous streaming replication
Previous Message Martin Vassilev 2014-03-26 15:35:44 Re: BUG #9722: select ILIKE is not case insensitive in UTF8 cyrillic