Re: [E] Regexp_replace bug / does not terminate on long strings

Поиск
Список
Период
Сортировка
От Miles Elam
Тема Re: [E] Regexp_replace bug / does not terminate on long strings
Дата
Msg-id CAALojA-uQ+C_SOa2tfX3-sZypVZJJasxaOS2JLbgPDoGaMtFGQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [E] Regexp_replace bug / does not terminate on long strings  (Mark Dilger <mark.dilger@enterprisedb.com>)
Ответы Re: [E] Regexp_replace bug / does not terminate on long strings  (Mark Dilger <mark.dilger@enterprisedb.com>)
Список pgsql-general
On Fri, Aug 20, 2021 at 12:32 PM Mark Dilger <mark.dilger@enterprisedb.com> wrote:

The following queries take radically different time to run:

Unbounded ranges seem like a problem. Seems worth trying a range from 1 to N where you play around with N to find your optimum performance/functionality tradeoff. {1,20} is like '+' but clamps at 20.

select regexp_replace(
  repeat('someone,one,one,one,one,one,one,', 60),
  '(?<=^|,)([^,]+)(?:,\1){1,20}(?=$|,)',
  '\1', -- replacement
  'g'  -- apply globally (all matches)
);
- Miles Elam

В списке pgsql-general по дате отправления:

Предыдущее
От: Mark Dilger
Дата:
Сообщение: Re: [E] Regexp_replace bug / does not terminate on long strings
Следующее
От: Mark Dilger
Дата:
Сообщение: Re: [E] Regexp_replace bug / does not terminate on long strings