Re: Pathological regexp match

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Michael Glaesemann <michael(dot)glaesemann(at)myyearbook(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Pathological regexp match
Date: 2010-01-29 02:59:22
Message-ID: 20100129025922.GA1793@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2010-01-29 03:00:50 Re: remove contrib/xml2
Previous Message KaiGai Kohei 2010-01-29 00:58:46 Re: [BUG?] strange behavior in ALTER TABLE ... RENAME TO on inherited columns