Thread: Re: [QUESTIONS] Postgresql dies with "FATAL 1: palloc failure: memory exhausted"

Re: [QUESTIONS] Postgresql dies with "FATAL 1: palloc failure: memory exhausted"

From
"Vadim B. Mikheev"
Date:
Chris Albertson wrote:
>
> This is just one example.  ++Every time++ I do a SELECT where
> the expected result is a large number of rows I get a
> failure of some type.
>
> testdb=> select count(*) from tassm16
> testdb-> where 15.5 < b_mag::float4 - (0.375 * (b_mag -
>          r_mag)::float4);
> FATAL 1:  palloc failure: memory exhausted
> testdb=>
>
> I can make Postgresql 6.3 fail every time.  Just do a SELECT
> where the number of rows returned is > a few million.  The

0.375 above is float8 and so server uses two float8 funcs to
calculate right op of '<' ==> 2 * palloc(8) for each row.
palloc(8) eats more than 8 bytes of memmory (~ 24): 2 * 24 = 48,
48 * 1_million_of_rows = 48 Mb.

This is problem of all data types passed by ref !!!
And this is old problem.

Vadim