Re: index usage in not like

From: Thom Brown <thombrown(at)gmail(dot)com>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: index usage in not like
Date: 2010-02-18 12:40:23
Message-ID: bddc86151002180440u153b1d95oc1d3de40762d95bf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 18 February 2010 12:18, A. Kretschmer
<andreas(dot)kretschmer(at)schollglas(dot)com> wrote:
> In response to Thom Brown :
>> On 18 February 2010 11:55, AI Rumman <rummandba(at)gmail(dot)com> wrote:
>> > "Not like" operation does not use index.
>> >
>> > select * from vtiger_contactscf where lower(cf_1253) not like
>> > lower('Former%')
>> >
>> > I created index on lower(cf_1253).
>> >
>> > How can I ensure index usage in not like operation?
>> > Anyone please help.
>> >
>>
>> How many rows do you have in your table?  If there are relatively few,
>> it probably guesses it to be cheaper to do a sequential scan and
>> calculate lower values on-the-fly rather than bother with the index.
>
> That's one reason, an other reason, i think, is, that a btree-index can't
> search with an 'not like' - operator.
>

Erm.. yes. Now that you say it, it's obvious. :S

Thom

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message A. Kretschmer 2010-02-18 12:43:44 Re: index usage in not like
Previous Message Kenneth Marshall 2010-02-18 12:26:22 Re: index usage in not like