Re: Regex performance regression induced by match-all code - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: Regex performance regression induced by match-all code
Date
Msg-id fc07bb1e-b55b-49e3-a55d-bc47b5ac828c@www.fastmail.com
Whole thread Raw
In response to Re: Regex performance regression induced by match-all code  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Regex performance regression induced by match-all code
List pgsql-hackers
On Sun, May 2, 2021, at 18:53, Tom Lane wrote:
fix-exponential-cost-of-checkmatchall-2.patch

Successfully tested.

SELECT
  is_match <> (subject ~ pattern),
  captured IS DISTINCT FROM regexp_match(subject, pattern, flags),
  COUNT(*)
FROM performance_test
GROUP BY 1,2
ORDER BY 1,2;
?column? | ?column? |  count
----------+----------+---------
f        | f        | 3253889
(1 row)

Time: 94149.542 ms (01:34.150)
Time: 91565.305 ms (01:31.565)
Time: 91565.305 ms (01:31.565)

SELECT regexp_matches('', '(.|){20}','');
regexp_matches
----------------
{""}
(1 row)

Time: 0.541 ms

SELECT regexp_matches('', '(.|){25}','');
regexp_matches
----------------
{""}
(1 row)

Time: 0.724 ms

SELECT regexp_matches('', '(.|){27}','');
regexp_matches
----------------
{""}
(1 row)

Time: 0.782 ms

/Joel

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: PG in container w/ pid namespace is init, process exits cause restart
Next
From: Tom Lane
Date:
Subject: Re: PG in container w/ pid namespace is init, process exits cause restart