Re: out of memory error on 3 table join

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Kirk Wythers <kwythers(at)umn(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: out of memory error on 3 table join
Date: 2006-12-12 10:49:25
Message-ID: 20061212104925.GA28714@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Dec 11, 2006 at 05:50:53PM -0600, Kirk Wythers wrote:
> met_data=# SELECT count(*) FROM climate, sites, solar WHERE
> climate.id = sites.id AND solar.id = sites.id AND climate.year = 1999;
> ----------
> 33061700
> (1 row)

<snip>

> psql(394) malloc: *** vm_allocate(size=396742656) failed (error code=3)
> psql(394) malloc: *** error: can't allocate region
> psql(394) malloc: *** set a breakpoint in szone_error to debug
> out of memory

Basically, it failed to allocate nearly 400MB of memory to store the
results. The question is: do you want ot store all 400MB at once?

If you don't, use a cursor.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-12-12 10:50:32 Re: Metadata from NEW and OLD constructs?
Previous Message Richard Huxton 2006-12-12 09:58:53 Re: Restore database from files (not dump files)?