Skip site navigation (1) Skip section navigation (2)

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

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Jesper Krogh <jesper(at)krogh(dot)cc>, pgsql-novice(at)postgresql(dot)org
Subject: Re: "between" is using index but "like" is not
Date: 2004-08-25 17:38:37
Message-ID: 200408251038.37508.josh@agliodbs.com (view raw or flat)
Thread:
Lists: pgsql-novice
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.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2004-08-25 18:59:59
Subject: Re: "between" is using index but "like" is not
Previous:From: Jesper KroghDate: 2004-08-25 13:30:50
Subject: "between" is using index but "like" is not

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group