Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WStC7-0003JY-U6 for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Mar 2014 19:09:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WStC7-00016l-CM for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Mar 2014 19:08:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WSrhJ-0003F7-13 for pgsql-bugs@postgresql.org; Wed, 26 Mar 2014 17:33:05 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WSrhG-00026L-T8 for pgsql-bugs@postgresql.org; Wed, 26 Mar 2014 17:33:04 +0000 MIME-Version: 1.0 Subject: BUG #9737: Trigram Regex degenerate case To: pgsql-bugs@postgresql.org From: kochismo@gmail.com Date: Wed, 26 Mar 2014 17:32:28 +0000 Message-ID: <20140326173228.26598.9250@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.3 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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