Re: LIKE without wildcard different from = - Mailing list pgsql-performance

From Tom Lane
Subject Re: LIKE without wildcard different from =
Date
Msg-id 21079.1280940107@sss.pgh.pa.us
Whole thread Raw
In response to LIKE without wildcard different from =  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: LIKE without wildcard different from =  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-performance
"Kevin Grittner" <Kevin.Grittner@wicourts.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

pgsql-performance by date:

Previous
From: "Kevin Grittner"
Date:
Subject: LIKE without wildcard different from =
Next
From: "Kevin Grittner"
Date:
Subject: Re: LIKE without wildcard different from =