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

Thu, 02 Apr 1998 09:37:27 +0800
"Vadim B. Mikheev" <vadim@sable.krasnoyarsk.su>
Re: [QUESTIONS] Postgresql dies with "FATAL 1: palloc failure: memory
	exhausted"