Re: "between" is using index but "like" is not

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Subject: Re: "between" is using index but "like" is not
Date: 2004-08-26 01:51:01
Message-ID: 412D4205.6000406@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Josh Berkus wrote:

> Jesper,
>
>
>>Why doesn't it use an index on the "like" operator when it doesn't contain
>>a wildcard in the beginning of the pattern?
>
>
> How many rows are there in the table? What happens if you force an index
> scan on the 2nd query? Is this ASCII text or UNICODE text?
>
> Normally LIKE 'xxx%' does use an index if it's useful, so there is something
> else going on here.

Shall not him define an index with the right operator class in order to be used
with the like operator ?

Regards
Gaetano Mendola

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bruce Momjian 2004-08-26 03:23:23 Re: Questions about pg_dump file
Previous Message Tom Lane 2004-08-25 18:59:59 Re: "between" is using index but "like" is not