Re: non index use on LIKE on a non pattern string - Mailing list pgsql-performance

From Cédric Villemain
Subject Re: non index use on LIKE on a non pattern string
Date
Msg-id 201206081351.54589.cedric@2ndquadrant.com
Whole thread Raw
In response to non index use on LIKE on a non pattern string  (Guillaume Cottenceau <gc@mnc.ch>)
Responses Re: non index use on LIKE on a non pattern string
List pgsql-performance
> I have noticed that with a SELECT query containing the following
> constraint:
>
>     column LIKE ?
>
> and an index on that column, PostgreSQL will not use the index
> even if the parameter doesn't contain special pattern characters
> such as %.

you should have a postgresql 8.3,isn't it ?
 like is equal to "=" in your case, since 8.4

Also you probably want to have a look at
 http://www.postgresql.org/docs/9.1/static/indexes-opclass.html
about your index definition (add the "text_pattern_ops" when required)

--
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation

Attachment

pgsql-performance by date:

Previous
From: Guillaume Cottenceau
Date:
Subject: non index use on LIKE on a non pattern string
Next
From: Rural Hunter
Date:
Subject: how to change the index chosen in plan?