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

From: Chris Mair <chris(at)1006(dot)org>
To: Marc Mamin <M(dot)Mamin(at)intershop(dot)de>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Counting the occurences of a substring within a very large text
Date: 2015-06-24 11:26:17
Message-ID: 4af08c5ca8ee2d5defafdd5b7f0e3841@smtp.hushmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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
>

Hi,

what's the size of full_message from mytable where id =-2146999703?

Also: Postgres version? OS? any extensions installed?

Bye,
Chris.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2015-06-24 11:43:59 Re: Counting the occurences of a substring within a very large text
Previous Message Marc Mamin 2015-06-24 10:55:22 Counting the occurences of a substring within a very large text