Re: Using index for "like 'ABC%'" type query - Mailing list pgsql-general

From Darko Prenosil
Subject Re: Using index for "like 'ABC%'" type query
Date
Msg-id 200304181817.04081.darko.prenosil@finteh.hr
Whole thread Raw
In response to Using index for "like 'ABC%'" type query  (lec <englim@pc.jaring.my>)
List pgsql-general
On Friday 18 April 2003 02:56, lec wrote:
> For current version of postgresql, is it possible for a query like below
> to utilize an index?
>
> select item_name from item where item_code like 'ABC%';
>
> Earlier versions of postgresql, eg, 6.5.3 can utilize the index.
>
>

    I think some other DB projects use something that is called
"BEGINS WITH" operator. Some time ago I tried to write such operator for
postgres. Unfortunatelly at that time I had no experience with postgres
internals, so the functions are written in PL/PSQL !!! They are working all
right, but the whole thing should be rewriten in C. If You are interested,
I'll send You the "code". For us using non "C" collations, I do not know for
other way. Of course if "C" collation satisfy Your needs, You do not need to
do such "hacks".

Regards !


pgsql-general by date:

Previous
From: Lincoln Yeoh
Date:
Subject: Re: default locale considered harmful? (was Re:
Next
From: Greg Stark
Date:
Subject: Casts to text/varchar