Re: Counting the occurences of a substring within a very large text

Поиск
Список
Период
Сортировка
Искать
От
Andy Colson
Тема
Re: Counting the occurences of a substring within a very large text
Дата
Msg-id
558AAF9D.1050200@squeakycode.net
Ответ на
Список
Дерево обсуждения
Counting the occurences of a substring within a very large text Marc Mamin <M.Mamin@intershop.de>
Re: Counting the occurences of a substring within a very large text Tom Lane <tgl@sss.pgh.pa.us>
Re: Counting the occurences of a substring within a very large text Chris Mair <chris@1006.org>
Re: Counting the occurences of a substring within a very large text Marc Mamin <M.Mamin@intershop.de>
Re: Counting the occurences of a substring within a very large text Andy Colson <andy@squeakycode.net>
Re: Counting the occurences of a substring within a very large text Albe Laurenz <laurenz.albe@wien.gv.at>
Re: Counting the occurences of a substring within a very large text Marc Mamin <M.Mamin@intershop.de>
Re: Counting the occurences of a substring within a very large text Albe Laurenz <laurenz.albe@wien.gv.at>
Re: Counting the occurences of a substring within a very large text Marc Mamin <M.Mamin@intershop.de>
Re: Counting the occurences of a substring within a very large text Geoff Winkless <pgsqladmin@geoff.dj>
Re: Counting the occurences of a substring within a very large text Marc Mamin <M.Mamin@intershop.de>
On 6/24/2015 5:55 AM, Marc Mamin wrote:
> Hello,
>
> I'd like to count the number  linebreaks within a string,
> but I get a memory allocation error when using regexp_matches or regexp_split_to_table.
>
> Any idea for an alternative to this problem  ?
>
> select count(*)-1 from
> (  select regexp_split_to_table(full_message,'(\n)', 'g')
>     from mytable
>     where id =-2146999703
> )foo;
>
> ERROR:  invalid memory alloc request size 1447215584
>
> regards,
>
> Marc Mamin
>
>

If its a large enough string, switching to plperl/plpython might give 
you a pleasant speedup.  There is a small overhead getting the string 
to/from pg, but the string ops will be much faster.

-Andy

В списке pgsql-general по дате отправления
От: Albe Laurenz
Дата:
От: Marc Mamin
Дата:
FAQ