Re: [SQL] Searching Text Fields - Case Sensitive?

From: Bart Ogryczak <bart(at)bart(dot)w-wa(dot)pl>
To: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Searching Text Fields - Case Sensitive?
Date: 1999-08-13 09:07:18
Message-ID: 37B3E046.278547CA@bart.w-wa.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Moray McConnachie wrote:

> > > SELECT * FROM mydb WHERE description LIKE "%foobar%";
> > > it seems to be case sensitive. Is there a way to do it so it is NOT
> > > case-sensitive?
> > SELECT * FROM mydb WHERE lower(description) LIKE "%foobar%";
>
> Brings up an interesting question. Which is faster, to use the lower/upper
> functions as above
[...]
> or to use the pattern matching case-insensitive operator?
LIKE seems to be much simpler then the regex pattern matching,
so IMHO, the lower/upper & LIKE combination may be faster for short
fields,
but probably might be slower on very long text fields (when it has to
convert
whole thing to lower/upper case, before doing LIKE).
Anyway, the differences are probably almost none either way.

bart
--
bart(at)bart(dot)w-wa(dot)pl || http://www.bart.w-wa.pl

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Hutton, Rob 1999-08-13 13:44:18 Problems with default date and time
Previous Message Moray McConnachie 1999-08-13 07:48:06 Re: [SQL] Searching Text Fields - Case Sensitive?