Re: Invalid memory alloc request

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Guy Helmer <ghelmer(at)palisadesys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Invalid memory alloc request
Date: 2009-08-25 17:05:06
Message-ID: 23213.1251219906@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Guy Helmer <ghelmer(at)palisadesys(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2009-08-25 17:09:34 Re: How to simulate crashes of PostgreSQL?
Previous Message james bardin 2009-08-25 16:54:54 Re: warm standby and reciprocating failover