Re: Pathological regexp match - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Pathological regexp match
Date
Msg-id 20100129025922.GA1793@alvh.no-ip.org
Whole thread Raw
In response to Pathological regexp match  (Michael Glaesemann <michael.glaesemann@myyearbook.com>)
Responses Re: Pathological regexp match
Re: Pathological regexp match
List pgsql-hackers
Hi Michael,

Michael Glaesemann wrote:
> We came across a regexp that takes very much longer than expected.
> 
> PostgreSQL 8.4.1 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44), 64-bit
> 
> SELECT 'ooo...' ~ $r$Z(Q)[^Q]*A.*?(\1)$r$; -- omitted for email brevity

The ? after .* is pointless.  If you remove it, the query returns
immediately.

(There's a badly needed CHECK_FOR_INTERRUPTS in this code BTW)

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Streaming replication, and walsender during recovery
Next
From: Alvaro Herrera
Date:
Subject: Re: remove contrib/xml2