Re: query planner: automatic rescribe of LIKE to BETWEEN ?
От
Alvaro Herrera
Тема
Re: query planner: automatic rescribe of LIKE to BETWEEN ?
Дата
Msg-id
20060822184957.GE25475@alvh.no-ip.org
Ответ на
Re: query planner: automatic rescribe of LIKE to BETWEEN ? (Thomas Samson)
Список
Дерево обсуждения
query planner: automatic rescribe of LIKE to BETWEEN ? Ulrich Habel <espero7757@gmx.net>
Re: query planner: automatic rescribe of LIKE to BETWEEN ? Tom Lane <tgl@sss.pgh.pa.us>
Re: query planner: automatic rescribe of LIKE to BETWEEN ? Alvaro Herrera <alvherre@commandprompt.com>
Re: query planner: automatic rescribe of LIKE to BETWEEN ? "Thomas Samson" <koollman@gmail.com>
Re: query planner: automatic rescribe of LIKE to BETWEEN ? Alvaro Herrera <alvherre@commandprompt.com>
Thomas Samson wrote: > On 8/22/06, Alvaro Herrera 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) Not sure. I'd try tsearch2 or pg_trgm (or pg_tgrm, whatever it's called). It's trigram indexing. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support
В списке pgsql-performance по дате отправления
От: Marinos Yannikos
Дата:
От: Alvaro Herrera
Дата: