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

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Ulrich Habel <espero7757(at)gmx(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: query planner: automatic rescribe of LIKE to BETWEEN ?
Date: 2006-08-22 17:45:39
Message-ID: 20060822174539.GD25475@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Marinos Yannikos 2006-08-22 18:10:49 VACUUM FULL needed sometimes to prevent transaction ID wraparound?
Previous Message Ulrich Habel 2006-08-22 17:22:59 query planner: automatic rescribe of LIKE to BETWEEN ?