Re: longest prefix match - Mailing list pgsql-general

From Jorge Godoy
Subject Re: longest prefix match
Date
Msg-id 200802200825.49084.jgodoy@gmail.com
Whole thread Raw
In response to longest prefix match  (Dragan Zubac <zubac@vlayko.tv>)
Responses Re: longest prefix match
List pgsql-general
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.)

--
Jorge Godoy      <jgodoy@gmail.com>


pgsql-general by date:

Previous
From: Jorge Godoy
Date:
Subject: Re:
Next
From: Oleg Bartunov
Date:
Subject: Re: longest prefix match