Skip site navigation (1) Skip section navigation (2)

Re: query planner: automatic rescribe of LIKE to BETWEEN ?

From: "Thomas Samson" <koollman(at)gmail(dot)com>
To: "Ulrich Habel" <espero7757(at)gmx(dot)net>, pgsql-performance(at)postgresql(dot)org
Subject: Re: query planner: automatic rescribe of LIKE to BETWEEN ?
Date: 2006-08-22 18:21:23
Message-ID: 4e96c6600608221121p2afc603bx90fcf879aab47d96@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
On 8/22/06, Alvaro Herrera <alvherre(at)commandprompt(dot)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

In response to

Responses

pgsql-performance by date

Next:From: Alvaro HerreraDate: 2006-08-22 18:49:57
Subject: Re: query planner: automatic rescribe of LIKE to BETWEEN ?
Previous:From: Marinos YannikosDate: 2006-08-22 18:10:49
Subject: VACUUM FULL needed sometimes to prevent transaction ID wraparound?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group