pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Carlo Stonebanks <stonec.register@sympatico.ca>
To: pgsql-performance@postgresql.org
Subject: How planner decides left-anchored LIKE can use index
Date: Thu, 6 Sep 2007 20:06:44 -0400
Message-ID: <fbq4md$3056$1@news.hub.org> (raw)

Exactly when does the planner decide that a left-anchored like can use the 
index?

I have replaced a WHEN lower(last_name) = 'smith'
with WHEN lower(last_name) like 'smith%'

There is an index on lower(last_name). I have seen the planner convert the 
LIKE to lower(last_name) >= 'smith' and lower(last_name) < 'smiti' on 8.2.4 
systems, but a slow sequence scan and filter on 8.1.9 - is this related to 
the version difference (8.1.9 vs 8.2.4) or is this related to something like 
operators/classes that have been installed?

Carlo 




view thread (2+ messages)  latest in thread

Message-ID: <fbq4md$3056$1@news.hub.org>
Permalink:  ../fbq4md$3056$1@news.hub.org/
Also on:    postgresql.org/message-id/fbq4md$3056$1@news.hub.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: stonec.register@sympatico.ca
  Subject: Re: How planner decides left-anchored LIKE can use index
  In-Reply-To: <fbq4md$3056$1@news.hub.org>

* 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