Re: Possible solution for LIKE optimization

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Possible solution for LIKE optimization
Date: 2001-08-06 01:45:14
Message-ID: Pine.LNX.4.30.0108060335290.11162-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane writes:

> Peter Eisentraut <peter_e(at)gmx(dot)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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-08-06 01:52:51 Re: Possible solution for LIKE optimization
Previous Message Tatsuo Ishii 2001-08-06 01:27:59 partial index