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