Re: Invalid memory alloc request - Mailing list pgsql-general

From Tom Lane
Subject Re: Invalid memory alloc request
Date
Msg-id 23213.1251219906@sss.pgh.pa.us
Whole thread Raw
In response to Re: Invalid memory alloc request  (Guy Helmer <ghelmer@palisadesys.com>)
List pgsql-general
Guy Helmer <ghelmer@palisadesys.com> writes:
> On the system where I captured the backtrace, there are several
> 400MB-long entries in the textdata column.  I inserted these entries by
> doing an "INSERT (..., textdata) VALUES (..., $1)", mmap'ed the data
> from a file into memory, and executed the command using PQexecParams().

OK, then it's just that the values are too long to print :-(

> Is there a quantifiable limit to the size of values I insert into a
> bytea column?  I haven't found a limit documented anywhere...

The hard limit is that the text representation has to fit into 1GB.
The text form can range from 1 to 5 characters per byte, so the worst
case would be that you hit this at about 200MB.

FWIW, there is already code in place for 8.5 that establishes a
hex-based representation with a 2:1 multiplier, so that you could expect
to go up to 500MB with future releases.  On the whole, though, you might
want to think about storing these values as large objects or external
files.

            regards, tom lane

pgsql-general by date:

Previous
From: james bardin
Date:
Subject: Re: warm standby and reciprocating failover
Next
From: Alvaro Herrera
Date:
Subject: Re: How to simulate crashes of PostgreSQL?