Best method to compare subdomains

From: Robert James <srobertjames(at)gmail(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Best method to compare subdomains
Date: 2013-01-16 20:23:30
Message-ID: CAGYyBgiSoKuO7ewt=7MGJ7sV5qFjxjec47RnkSE=QxoLVAE4qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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).

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2013-01-16 22:17:46 Re: Best method to compare subdomains
Previous Message Marcel van Pinxteren 2013-01-16 19:40:45 Re: Case insensitive collation