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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux