From: Pedro Gimeno <pgsql-004@personal.formauri.es>
To: Sandro Santilli <strk@keybit.net>
Cc: pgsql-bugs@postgresql.org
Subject: Re: uninterruptable regexp_replace in 9.2 and 9.3
Date: Fri, 28 Feb 2014 14:42:51 +0100
Message-ID: <5310925B.8010809@personal.formauri.es> (raw)
In-Reply-To: <20140228112858.GE5011@localhost>
References: <20140228112858.GE5011@localhost>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Sandro Santilli wrote, On 2014-02-28 12:28:
> Starting with commit 173e29aa5 the regexp_replace function
> became uninterruptable during operations, and takes a lot
> of time and RAM to process some patterns.
>
> Full story in this thread:
> http://www.postgresql.org/message-id/646.1393031856@sss.pgh.pa.us
>
> I'm hoping a mail to pgsql-bugs would assign this issue a ticket
> number for me to follow. Let me know if there's a better way.
> Thank you !
This may be relevant:
https://gist.github.com/johnbartholomew/8379265
I've added these lines:
printf 'Testing psql:\n'
time psql -c "SELECT regexp_matches('$pattern','$input');"
The results in my machine are (with PostgreSQL 9.1.9):
Pattern:
"a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaaaaaa"
Input: "aaaaaaaaaaaaaaaaaaaaaaaaaaa"
Testing grep:
aaaaaaaaaaaaaaaaaaaaaaaaaaa
real 0m0.003s
user 0m0.000s
sys 0m0.000s
Testing perl:
match
real 0m6.103s
user 0m6.100s
sys 0m0.000s
Testing python:
<_sre.SRE_Match object at 0xb70e2250>
real 0m10.207s
user 0m10.141s
sys 0m0.060s
Testing psql:
regexp_matches
-------------------------------
{aaaaaaaaaaaaaaaaaaaaaaaaaaa}
(1 row)
real 0m0.039s
user 0m0.024s
sys 0m0.004s
Interestingly, as noted in the comments, PHP reports an error that the
backtracking limit was reached.
I'm adding this note in case it helps anyone get a bigger picture as to
what other implementations do about this problem.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: pgsql-004@personal.formauri.es, strk@keybit.net
Subject: Re: uninterruptable regexp_replace in 9.2 and 9.3
In-Reply-To: <5310925B.8010809@personal.formauri.es>
References: <20140228112858.GE5011@localhost> <5310925B.8010809@personal.formauri.es>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox