pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: T.J.Farrell <T.J.Farrell@wanadoo.fr>
Cc: pgsql-sql@postgresql.org
Subject: Re: LIKE vrs ~~
Date: Sun, 4 Jun 2000 03:46:22 +0200 (CEST)
Message-ID: <Pine.LNX.4.21.0006040326220.348-100000@localhost.localdomain> (raw)
In-Reply-To: <000601bfcd9a$c39f06e0$2c3cfac1@oemcomputer>

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





view thread (3+ messages)  latest in thread

Message-ID: <Pine.LNX.4.21.0006040326220.348-100000@localhost.localdomain>
Permalink:  ../Pine.LNX.4.21.0006040326220.348-100000@localhost.localdomain/
Also on:    postgresql.org/message-id/Pine.LNX.4.21.0006040326220.348-100000@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: peter_e@gmx.net, T.J.Farrell@wanadoo.fr
  Subject: Re: LIKE vrs ~~
  In-Reply-To: <Pine.LNX.4.21.0006040326220.348-100000@localhost.localdomain>
  References: <000601bfcd9a$c39f06e0$2c3cfac1@oemcomputer> <Pine.LNX.4.21.0006040326220.348-100000@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox