Re: Why my queryes doesnt not use indexes?

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Why my queryes doesnt not use indexes?
Date: 2009-06-22 23:22:23
Message-ID: 20090622232223.GO5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Maclean 2009-06-22 23:28:41 Re: postgresql-8.3.7 unexpected connection closures
Previous Message Sam Mason 2009-06-22 23:16:16 Re: Slight change in query leads to unexpected change in query plan