From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Greg Stark <gsstark(at)mit(dot)edu> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Matthew Gabeler-Lee <mgabelerlee(at)zycos(dot)com>, "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: 7.3 no longer using indexes for LIKE queries |
Date: | 2002-12-09 00:38:43 |
Message-ID: | Pine.LNX.4.44.0212090056030.25355-100000@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Greg Stark writes:
> It seems like there's an obvious easy fix for this. Allow indexes to be
> created a simple non-locale dependent lexical sort order. They wouldn't be
> useful for sorting in the locale sort order but they would be useful for the
> case at hand.
There has already been a proposed implementation of that idea, but it has
been rejected because of some interpretational problems with how exactly
the LIKE operator should respond to locale settings.
According to the SQL standard, constant strings that are part of a
pattern should be compared using the relevant collation order. If this
were implemented (which it currently isn't), then an index based on
strxfrm() should be used. The current implementation should use an index
based on a binary comparison opclass. We need to figure out which exactly
we want to proceed with.
I will point out that I believe that an implemenation following the SQL
standard model won't be particularly practical. First of all, strings
that are not binary equivalents won't be compare as equal under any
reasonable collation. Second, even if that were the case, it would
certainly not be appropriate to use for the LIKE operator. Third, some of
the rules that underly many collations would cause the LIKE operator to
have pretty bizarre results. For example, sometimes the strings are
compared backwards from the end of the string to the start, and it's not
clear how that should behave when faced with a wildcard pattern anchored
to the start.
--
Peter Eisentraut peter_e(at)gmx(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Doug McNaught | 2002-12-09 01:16:33 | Re: UPDATE syntax problem |
Previous Message | MT | 2002-12-09 00:34:14 | Re: UPDATE syntax problem |