Re: WIP: index support for regexp search - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: WIP: index support for regexp search
Date
Msg-id CAPpHfdvPiGh0b0u=iuvKAOXbuX49EuN-NBLrEF3MFA6xYDh93g@mail.gmail.com
Whole thread Raw
In response to Re: WIP: index support for regexp search  (Tomas Vondra <tv@fuzzy.cz>)
Responses Re: WIP: index support for regexp search  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
Some quick comments.

On Tue, Nov 20, 2012 at 3:02 AM, Tomas Vondra <tv@fuzzy.cz> wrote:
6) It does not compile - I do get a bunch of errors like this
Fixed. 

7) Once fixed, it seems to work

CREATE EXTENSION pg_trgm ;
CREATE TABLE TEST (val TEXT);
INSERT INTO test
       SELECT md5(i::text) FROM generate_series(1,1000000) s(i);
CREATE INDEX trgm_idx ON test USING gin (val gin_trgm_ops);
ANALYZE test;

EXPLAIN SELECT * FROM test WHERE val ~ '.*qqq.*';


                           QUERY PLAN
---------------------------------------------------------------------
 Bitmap Heap Scan on test  (cost=16.77..385.16 rows=100 width=33)
   Recheck Cond: (val ~ '.*qqq.*'::text)
   ->  Bitmap Index Scan on trgm_idx  (cost=0.00..16.75 rows=100
                                       width=0)
         Index Cond: (val ~ '.*qqq.*'::text)
(4 rows)

but I do get a bunch of NOTICE messages with debugging info (no matter
if the GIN index is used or not, so it's somewhere in the common regexp
code). But I guess that's due to WIP status.
It's due to TRGM_REGEXP_DEBUG macro. I disabled it by default. But I think pieces of code hidden by that macro could be useful for debug even after WIP status.

------
With best regards,
Alexander Korotkov.
Attachment

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: WIP: index support for regexp search
Next
From: Peter Eisentraut
Date:
Subject: Re: MySQL search query is not executing in Postgres DB