Re: Possible solution for LIKE optimization

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "PostgreSQL Development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Possible solution for LIKE optimization
Date: 2001-08-06 18:31:27
Message-ID: 23920.997122687@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp> writes:
>>> Do we have to make 2 indexes for non_ASCII text field ?
>>
>> You would if you want to use indexscans for both LIKE and "x < 'FOO'"
>> (ie, locale-aware comparisons).

> And ORDER BY ?

Well, the assumption is that we'd make a second set of string comparison
operators that are defined as not-locale-aware. Names still to be
chosen, but let's suppose they're $=$, $<$, $<=$, etc. Then

SELECT ... ORDER BY foo;

would want to use a plain index (defined using locale-aware comparison),
whereas

SELECT ... ORDER BY foo USING $<$;

would want to use a non-locale-aware index. So you could use such an
index for sorting, as long as you were content to have non-locale-aware
output ordering.

> I'm not familiar with non_ASCII locale.
> Is 'ss' always guaranteed to be LIKE 's%' for example ?

I'd assume so, but I'd be interested to hear whether native speakers
of German think that that's appropriate in their locale ...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-08-06 19:07:09 RE: Possible solution for LIKE optimization
Previous Message Hiroshi Inoue 2001-08-06 17:47:10 RE: Possible solution for LIKE optimization