Re: LIKE without wildcard different from =

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: LIKE without wildcard different from =
Date: 2010-08-04 16:41:47
Message-ID: 21079.1280940107@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> We have been using the C locale for everything at our site, but
> there is occasionally talk of supporting characters outside the
> ASCII7 set. In playing around with indexing, to see what the impact
> of that would be, I stumbled across something which was mildly
> surprising.

> In the C locale, if you want to search for an exact value which
> doesn't contain wildcard characters, it doesn't matter whether you
> use the 'LIKE' operator or the '=' operator. With LATIN1 encoding,
> it made three orders of magnitude difference, both in the estimated
> cost and the actual run time.

What PG version are you testing? 8.4 and up should know that an
exact-match pattern can be optimized regardless of the lc_collate
setting.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2010-08-04 16:52:24 Re: LIKE without wildcard different from =
Previous Message Kevin Grittner 2010-08-04 16:34:12 LIKE without wildcard different from =