pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Samson <koollman@gmail.com>
To: Ulrich Habel <espero7757@gmx.net>
To: pgsql-performance@postgresql.org
Subject: Re: query planner: automatic rescribe of LIKE to BETWEEN ?
Date: Tue, 22 Aug 2006 20:21:23 +0200
Message-ID: <4e96c6600608221121p2afc603bx90fcf879aab47d96@mail.gmail.com> (raw)
In-Reply-To: <20060822174539.GD25475@alvh.no-ip.org>
References: <200608221922.59734.espero7757@gmx.net>
	<20060822174539.GD25475@alvh.no-ip.org>

On 8/22/06, Alvaro Herrera <alvherre@commandprompt.com> wrote:
> Ulrich Habel wrote:
> > Hello all,
> > had an idea of optimizing a query that may work generally.
> >
> > In case a 'column' is indexed, following two alterations could be done
> > I think:
> >
> > A)
> >
> >   select ... where column ~ '^Foo'     -->  Seq Scan
>
> This is not true.  You can make this query use an index if you create it
> with opclass varchar_pattern_ops or text_pattern_ops, as appropiate.
>
> Thus you don't need any hack here.
>

And in the case of more general expression, like:
 select ... where column ~ 'something';

Is there a way to optimise this ? (in the case where 'something' is not
a word, but a part of a word)

-- 
Thomas SAMSON



view thread (5+ messages)  latest in thread

Message-ID: <4e96c6600608221121p2afc603bx90fcf879aab47d96@mail.gmail.com>
Permalink:  ../4e96c6600608221121p2afc603bx90fcf879aab47d96@mail.gmail.com/
Also on:    postgresql.org/message-id/4e96c6600608221121p2afc603bx90fcf879aab47d96@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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: koollman@gmail.com, espero7757@gmx.net
  Subject: Re: query planner: automatic rescribe of LIKE to BETWEEN ?
  In-Reply-To: <4e96c6600608221121p2afc603bx90fcf879aab47d96@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