From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Best method to compare subdomains |
Date: | 2013-01-18 09:45:43 |
Message-ID: | kdb5k7$kmm$2@gonzo.reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2013-01-16, 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).
write a function that does the string mangling you describe above and
then index on the result.
then you can use like and the index will help.
--
⚂⚃ 100% natural
From | Date | Subject | |
---|---|---|---|
Next Message | Jasen Betts | 2013-01-18 10:00:18 | Re: Case insensitive collation |
Previous Message | Bartosz Dmytrak | 2013-01-18 09:20:52 | Functions not visible in pg_stat_user_functions view |