Re: LIKE vrs ~~

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "T(dot)J(dot)Farrell" <T(dot)J(dot)Farrell(at)wanadoo(dot)fr>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: LIKE vrs ~~
Date: 2000-06-04 01:46:22
Message-ID: Pine.LNX.4.21.0006040326220.348-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

T.J.Farrell writes:

> I was wondering about the performance incidence of :
> SELECT * FROM table1 WHERE UPPER(field1) LIKE UPPER('%thomas%');
> versus:
> SELECT * FROM table1 WHERE field1 ~~ '%thomas%'

If you're comparing ~~ with LIKE then there's no difference at all. (Only
the extra cycles to convert LIKE to ~~ internally.) If you're comparing
true case-insensitive matching to using UPPER, then the latter is probably
faster but doesn't really do the same thing.

--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-06-04 19:19:11 Re: LIKE vrs ~~
Previous Message qzhwjb 2000-06-04 00:24:50 Ho Ho Ho !!! 6684