Re: Why my queryes doesnt not use indexes? - Mailing list pgsql-general

From Sam Mason
Subject Re: Why my queryes doesnt not use indexes?
Date
Msg-id 20090622232223.GO5407@samason.me.uk
Whole thread Raw
In response to Why my queryes doesnt not use indexes?  (DaNieL <daniele.pignedoli@gmail.com>)
List pgsql-general
On Mon, Jun 22, 2009 at 08:43:43AM -0700, DaNieL wrote:
> Hi guys, i am in trouble with some simple data that seem like doesnt
> use any index.. and i dont know why.

It can be for a couple of reasons; firstly using an index isn't always a
good thing.  In your case I'd guess you probably want to probably want
to do the following when creating the index:

> CREATE INDEX users_nick_index ON users (nickname varchar_pattern_ops);

That will allow PG to use the index in LIKE expressions.  For more
details see:

  http://www.postgresql.org/docs/current/static/indexes-opclass.html

--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Sam Mason
Date:
Subject: Re: Slight change in query leads to unexpected change in query plan
Next
From: Andrew Maclean
Date:
Subject: Re: postgresql-8.3.7 unexpected connection closures