LIKE query on indexes

From: "Ibrahim Tekin" <itekin(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: LIKE query on indexes
Date: 2006-02-21 15:57:12
Message-ID: e4dcba670602210757n2caf7c15t2a93353c9081c51f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

hi,
i have btree index on a text type field. i want see rows which starts with
certain characters on that field. so i write a query like this:

SELECT * FROM mytable WHERE myfield LIKE 'john%'

since this condition is from start of the field, query planner should use
index to find such elements but explain command shows me it will do a
sequential scan.

is this lack of a feature or i am wrong somewhere?

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2006-02-21 16:18:00 Re: LIKE query on indexes
Previous Message Virag Saksena 2006-02-21 06:33:39 Re: Cost Issue - How do I force a Hash Join