pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ibrahim Tekin <itekin@gmail.com>
To: pgsql-performance@postgresql.org
Subject: LIKE query on indexes
Date: Tue, 21 Feb 2006 17:57:12 +0200
Message-ID: <e4dcba670602210757n2caf7c15t2a93353c9081c51f@mail.gmail.com> (raw)

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?

view thread (9+ messages)  latest in thread

Message-ID: <e4dcba670602210757n2caf7c15t2a93353c9081c51f@mail.gmail.com>
Permalink:  ../e4dcba670602210757n2caf7c15t2a93353c9081c51f@mail.gmail.com/
Also on:    postgresql.org/message-id/e4dcba670602210757n2caf7c15t2a93353c9081c51f@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: itekin@gmail.com
  Subject: Re: LIKE query on indexes
  In-Reply-To: <e4dcba670602210757n2caf7c15t2a93353c9081c51f@mail.gmail.com>
  References: <e4dcba670602210757n2caf7c15t2a93353c9081c51f@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox