From: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
---|---|
To: | Jorge Godoy <jgodoy(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: longest prefix match |
Date: | 2008-02-20 12:00:22 |
Message-ID: | Pine.LNX.4.64.0802201459290.31180@sn.sai.msu.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On Wed, 20 Feb 2008, Jorge Godoy wrote:
> Em Wednesday 20 February 2008 05:55:07 Dragan Zubac escreveu:
>>
>> Anybody got any ideas/experiences/links for 'longest prefix match'
>> solution in PostgreSQL ?
>> Basically,put some telephone prefices in some kind of trie,and be able
>> to perform fast lookups ?
>
> Prefix or suffix?
>
> For prefix you can use "SELECT number FROM table WHERE number LIKE '123%'".
>
> For suffix you change the "%" to the beginning of the string, but then loose
> the ability to use indices. (Unfortunately, using suffixes is really
> interesting for caller IDs since you don't always receive area code, country
> code, etc.)
you can maintain an additional index for terms backwards.
>
>
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru)
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83
From | Date | Subject | |
---|---|---|---|
Next Message | Postgres User | 2008-02-20 12:29:20 | Re: Regex query not using index |
Previous Message | Jorge Godoy | 2008-02-20 11:25:48 | Re: longest prefix match |
From | Date | Subject | |
---|---|---|---|
Next Message | Sergey E. Koposov | 2008-02-20 12:17:11 | Re: failed assertion in toasting code |
Previous Message | Gregory Stark | 2008-02-20 11:55:27 | Re: failed assertion in toasting code |