Re: LIKE vrs ~~ - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: LIKE vrs ~~
Date
Msg-id Pine.LNX.4.21.0006040326220.348-100000@localhost.localdomain
Whole thread Raw
In response to LIKE vrs ~~  ("T.J.Farrell" <T.J.Farrell@wanadoo.fr>)
List 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@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




pgsql-sql by date:

Previous
From: qzhwjb@myhome.net
Date:
Subject: Ho Ho Ho !!! 6684
Next
From: Tom Lane
Date:
Subject: Re: LIKE vrs ~~