Re: matching column of regexps

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: matching column of regexps
Дата
Msg-id 537951B6.4070202@dalibo.com
обсуждение исходный текст
Ответ на matching column of regexps  (James Cloos <cloos@jhcloos.com>)
Ответы Re: matching column of regexps  (James Cloos <cloos@jhcloos.com>)
Список pgsql-sql
On 05/18/2014 07:44 PM, James Cloos wrote:
> Is there a better way to answer the question, "Do ANY rows match?"
> without having to return the list of matching rows?  I didn't find
> anything googling.

select exists (select 1 from retest where active is true and ? ~ re);


> Is there a way to index such a table/query?

There are several ways to index such a query.  If there are very many
rows but with only a few being active, then a partial index will do wonders.

http://www.postgresql.org/docs/current/static/indexes-partial.html

Otherwise, it is possible to use an index for regular expressions using
the pg_trgm extension.

http://www.postgresql.org/docs/current/static/pgtrgm.html

-- 
Vik




В списке pgsql-sql по дате отправления:

Предыдущее
От: James Cloos
Дата:
Сообщение: matching column of regexps
Следующее
От: James Cloos
Дата:
Сообщение: Re: matching column of regexps