Re: grep -f keyword data query - Mailing list pgsql-general

From Hiroyuki Sato
Subject Re: grep -f keyword data query
Date
Msg-id CA+Tq-RpVx=ErQ_GWZbxv0yxmoNJzw_rdE_zx0wJEdiGX-+ohfw@mail.gmail.com
Whole thread Raw
In response to Re: grep -f keyword data query  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: grep -f keyword data query  (David Rowley <david.rowley@2ndquadrant.com>)
List pgsql-general
Hello David

Thank you for replying.

2015年12月30日(水) 6:04 David Rowley <david.rowley@2ndquadrant.com>:
On 30 December 2015 at 04:21, Hiroyuki Sato <hiroysato@gmail.com> wrote:
2015年12月29日(火) 4:35 Jeff Janes <jeff.janes@gmail.com>:
 
But, the planner refuses to use this index for your query anyway,
because it can't see that the patterns are all left-anchored.

Really, your best bet is refactor your url data so it is stored with a
url_prefix and url_suffix column.  Then you can do exact matching
rather than pattern matching.
I see, exact matching faster than pattern matting. 
But I need pattern match in path part 
 I would like to pattern match '/a/b/c' part. 

If your pattern matching is as simple as that, then why not split the /a/b/c/ part out as mentioned by Jeff? Alternatively you could just write a function which splits that out for you and returns it, then index that function, and then just include a call to that function in the join condition matching with the equality operator. That'll allow hash and merge joins to be possible again. 

Could you tell me more detail about Alternatively part?

It is good idea to split host and part.
I'll try it. 

My matching pattern is the following
1, http://www.yahoo.com/a/b/% (host equal, path like)
2, http://%.yahoo.com/a/b/%   (host and path like )

Can I use equality operator in those cases?

Best regards.
 
 
--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: efficient math vector operations on arrays
Next
From: David Rowley
Date:
Subject: Re: grep -f keyword data query