agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: James Cloos <cloos@jhcloos.com>
To: Vik Fearing <vik.fearing@dalibo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: matching column of regexps
Date: Mon, 19 May 2014 01:43:33 -0400
Message-ID: <m3r43q5nmp.fsf@carbon.jhcloos.org> (raw)
In-Reply-To: <537951B6.4070202@dalibo.com>
References: <m3wqdi649f.fsf@carbon.jhcloos.org>
<537951B6.4070202@dalibo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
>>>>> "VF" == Vik Fearing <vik.fearing@dalibo.com> writes:
JC>> Is there a better way to answer the question, "Do ANY rows match?"
VF> select exists (select 1 from retest where active is true and ? ~ re);
Ah. Yes. I'd forgotten about select exists. I cannot recall whether I
ever used it in anger, or just played around after reading about it.
It should stick this time.
>> Is there a way to index such a table/query?
VF> There are several ways to index such a query. If there are very many
VF> rows but with only a few being active, then a partial index will do wonders.
Its more likely only a few will be inactive.
VF> Otherwise, it is possible to use an index for regular expressions using
VF> the pg_trgm extension.
Perfect. I see trgm index support for ~, et alia is new in 9.3.
Exactly the kicks in the skull I needed.
Thanks,
-JimC
--
James Cloos <cloos@jhcloos.com> OpenPGP: 0x997A9F17ED7DAEA6
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (3+ messages)
Message-ID: <m3r43q5nmp.fsf@carbon.jhcloos.org>
Permalink: ../m3r43q5nmp.fsf@carbon.jhcloos.org/
Also on: postgresql.org/message-id/m3r43q5nmp.fsf@carbon.jhcloos.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: cloos@jhcloos.com, vik.fearing@dalibo.com
Subject: Re: matching column of regexps
In-Reply-To: <m3r43q5nmp.fsf@carbon.jhcloos.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox