Re: Possible solution for LIKE optimization - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Possible solution for LIKE optimization
Date
Msg-id Pine.LNX.4.30.0108060335290.11162-100000@peter.localdomain
Whole thread Raw
In response to Re: Possible solution for LIKE optimization  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Possible solution for LIKE optimization
List pgsql-hackers
Tom Lane writes:

> Peter Eisentraut <peter_e@gmx.net> writes:
> > I have had an idea how the LIKE optimization problem could be solved.
>
> Hmm ... so in a non-ASCII locale, we'd have to look for an index on
> strxfrm(A) rather than directly on A.  And the index would need to
> use a nonstandard operator set --- ie, *non* locale aware comparison
> operators (which might be useful for other purposes anyway).

Wait, why isn't that the solution in the first place.  Let's build the
index with an opclass that uses plain strcmp comparison.  Then you can
compute the bounds using the method 'foo' <= 'foo%' <= 'fop'.  We don't
need to trick the locale facilities, we just avoid using them.  LIKE is
defined in terms of character elements, not collation elements, so that's
okay.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: partial index
Next
From: Digital Wokan
Date:
Subject: Sorry about that unsubscribe