Re: Indexing and regular expressions

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Kjartan Ásþórsson <a98kjaas(at)student(dot)his(dot)se>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Indexing and regular expressions
Date: 2002-04-07 10:54:27
Message-ID: Pine.GSO.4.44.0204071349410.17912-100000@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 7 Apr 2002, [ISO-8859-1] Kjartan аsЧСrsson wrote:

> Is there any indexing technique available I can use when joining tables
> with a regular expression pattern in pgsql?
>
> I know one method for indexing strings that will be matched with regular
> expression patterns, and that is using so called k-gram indexes.
> Indexing the string "kjartan" with k-gram index where k = 3 would
> create "kja", "jar", "art", "rta", "tan" as an index. Ofcourse it is hard to

Usually, k-grams technique is used to match patterns with errors and
3-grams produce "__k", "_kj", "kja", "jar", "art", "rta", "ta_", "a__"
where leading and trailing spaces are used to compensate 'boundary' effect.

But I dont' quite understand your question. Are you looking for fuzzy match ?
If so, take a look on contrib modules.

> decide the size of k and I'm sure in many cases mulitple k values might
> be needed, depending on the situation.
>
> I have not done any major survey of available techniques, but I was
> hoping I could get some pointers here.
>
> I assume pgsql always uses nested loop join when joining relations which are
> joined with regular expression pattern?
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2002-04-07 11:44:55 Re: What's the CURRENT schema ?
Previous Message Kjartan Ásþórsson 2002-04-07 10:09:36 Indexing and regular expressions