| From: | Sumit Raja <sumit(dot)raja(at)raja-consulting(dot)co(dot)uk> |
|---|---|
| To: | pgsql <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Best method to compare subdomains |
| Date: | 2013-01-17 09:12:01 |
| Message-ID: | CAB4mO2ePctb2s_X-FfH9b6HaXJHZFukdLgkD8tWZYOH=RdQPJg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 16 January 2013 20:23, Robert James <srobertjames(at)gmail(dot)com> wrote:
> Is there a recommended, high performance method to check for subdomains?
>
> Something like:
> - www.google.com is subdomain of google.com
> - ilikegoogle.com is not subdomain of google.com
>
> There are many ways to do this (lowercase and reverse the string,
> append a '.' if not there, append a '%', and do a LIKE). But I'm
> looking for one that will perform well when the master domain list is
> an indexed field in a table, and when the possible subdomain is either
> an individual value, or a field in a table for a join (potentially
> indexed).
>
Maybe the ltree extension will suit what you are trying to do?
http://www.postgresql.org/docs/9.2/static/ltree.html
| From | Date | Subject | |
|---|---|---|---|
| Next Message | John R Pierce | 2013-01-17 09:22:19 | Re: Best method to compare subdomains |
| Previous Message | Stuart Bishop | 2013-01-17 08:18:09 | Re: plpython intermittent ImportErrors |