Re: cant get an index scan with a LIKE

From: "Greg Caulton" <caultonpos(at)gmail(dot)com>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-performance(at)postgresql(dot)org
Subject: Re: cant get an index scan with a LIKE
Date: 2008-10-07 00:15:50
Message-ID: e44fb6470810061715j76ecf103h111e0e76f8bc23bb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

That worked great - THANKS!

CREATE INDEX sct_descriptions_k2
ON sct_descriptions
USING btree
(term_index varchar_pattern_ops);

I noticed I had to keep the original index for the non-like operator
but that is not a big deal

CREATE INDEX sct_descriptions_k1
ON sct_descriptions
USING btree
(term_index );

thanks again

Greg

On Mon, Oct 6, 2008 at 7:59 PM, Kevin Grittner
<Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
>>>> "Greg Caulton" <caultonpos(at)gmail(dot)com> wrote:
>
>> but I get a sequential scan when I do where term_index like
>>
>> select * from sct_descriptions where term_index like 'CHILLS AND
> FEVER
>> (FINDING)'
>
>> Is there anything else I can do? Settings below, this is PostgreSQL
> 8.3
>
>> "lc_collate";"English_United States.1252"
>> "lc_ctype";"English_United States.1252"
>> "lc_messages";"English_United States"
>> "lc_monetary";"English_United States"
>> "lc_numeric";"English_United States"
>> "lc_time";"English_United States"
>
> This issue is discussed here:
>
> http://www.postgresql.org/docs/8.2/interactive/locale.html
>
> with a solution to your specific problem mentioned here:
>
> http://www.postgresql.org/docs/8.2/interactive/indexes-opclass.html
>
> You can create an index with the appropriate operator type to get LIKE
> to work as you want. I hope this helps.
>
> -Kevin
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Matthew Wakeling 2008-10-08 11:55:52 Disc space usage
Previous Message Kevin Grittner 2008-10-06 23:59:33 Re: cant get an index scan with a LIKE